From 120b0b7f6df0c8978aac9a423cbf8364feac4779 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 10 Aug 2019 18:23:48 +0200 Subject: Statistics -> Attributes. --- src/battle/src/Struct/Character.elm | 14 +- src/battle/src/Struct/HelpRequest.elm | 4 +- src/battle/src/Update/SelectCharacter.elm | 6 +- src/battle/src/Update/UndoAction.elm | 6 +- src/battle/src/View/Controlled/CharacterCard.elm | 56 ++--- src/battle/src/View/Controlled/Targets.elm | 10 +- src/battle/src/View/MessageBoard/Help.elm | 6 +- src/battle/src/View/MessageBoard/Help/Guide.elm | 2 +- .../src/shared/battle-characters/info-card.scss | 7 +- src/css/src/shared/omnimod-icons.scss | 4 +- src/map-editor/src/Struct/HelpRequest.elm | 4 +- src/map-editor/src/View/MessageBoard/Help.elm | 6 +- src/map-editor/src/View/SubMenu/TileStatus.elm | 4 +- src/roster-editor/src/Struct/HelpRequest.elm | 4 +- src/roster-editor/src/View/CharacterCard.elm | 54 ++--- src/roster-editor/src/View/MessageBoard/Help.elm | 6 +- .../BattleCharacters/Struct/Character.elm | 20 +- src/shared/battle/Battle/Lang/English.elm | 64 ++--- src/shared/battle/Battle/Struct/Attributes.elm | 162 +++++++++++++ src/shared/battle/Battle/Struct/Omnimods.elm | 42 ++-- src/shared/battle/Battle/Struct/Statistics.elm | 162 ------------- src/shared/battle/Battle/View/Attribute.elm | 259 +++++++++++++++++++++ src/shared/battle/Battle/View/Help/Attribute.elm | 62 +++++ src/shared/battle/Battle/View/Help/Statistic.elm | 62 ----- src/shared/battle/Battle/View/Omnimods.elm | 20 +- src/shared/battle/Battle/View/Statistic.elm | 259 --------------------- 26 files changed, 650 insertions(+), 655 deletions(-) create mode 100644 src/shared/battle/Battle/Struct/Attributes.elm delete mode 100644 src/shared/battle/Battle/Struct/Statistics.elm create mode 100644 src/shared/battle/Battle/View/Attribute.elm create mode 100644 src/shared/battle/Battle/View/Help/Attribute.elm delete mode 100644 src/shared/battle/Battle/View/Help/Statistic.elm delete mode 100644 src/shared/battle/Battle/View/Statistic.elm diff --git a/src/battle/src/Struct/Character.elm b/src/battle/src/Struct/Character.elm index 73531f0..327d23c 100644 --- a/src/battle/src/Struct/Character.elm +++ b/src/battle/src/Struct/Character.elm @@ -32,7 +32,7 @@ import Json.Decode.Pipeline -- Battle ---------------------------------------------------------------------- import Battle.Struct.Omnimods -import Battle.Struct.Statistics +import Battle.Struct.Attributes -- Battle Characters ----------------------------------------------------------- import BattleCharacters.Struct.Character @@ -88,8 +88,8 @@ fix_health : Int -> Type -> Type fix_health previous_max_health char = let new_max_health = - (Battle.Struct.Statistics.get_max_health - (BattleCharacters.Struct.Character.get_statistics char.base) + (Battle.Struct.Attributes.get_max_health + (BattleCharacters.Struct.Character.get_attributes char.base) ) in {char | @@ -162,8 +162,8 @@ set_location : ( set_location location omnimods char = let previous_max_health = - (Battle.Struct.Statistics.get_max_health - (BattleCharacters.Struct.Character.get_statistics char.base) + (Battle.Struct.Attributes.get_max_health + (BattleCharacters.Struct.Character.get_attributes char.base) ) in (fix_health @@ -188,8 +188,8 @@ set_base_character : BattleCharacters.Struct.Character.Type -> Type -> Type set_base_character new_base char = let previous_max_health = - (Battle.Struct.Statistics.get_max_health - (BattleCharacters.Struct.Character.get_statistics char.base) + (Battle.Struct.Attributes.get_max_health + (BattleCharacters.Struct.Character.get_attributes char.base) ) in (fix_health diff --git a/src/battle/src/Struct/HelpRequest.elm b/src/battle/src/Struct/HelpRequest.elm index 0e30162..7df06cb 100644 --- a/src/battle/src/Struct/HelpRequest.elm +++ b/src/battle/src/Struct/HelpRequest.elm @@ -3,7 +3,7 @@ module Struct.HelpRequest exposing (Type(..)) -- Elm ------------------------------------------------------------------------- -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.Struct.DamageType -- Local Module ---------------------------------------------------------------- @@ -15,5 +15,5 @@ import Struct.Character type Type = None | Rank Struct.Character.Rank - | Statistic Battle.Struct.Statistics.Category + | Attribute Battle.Struct.Attributes.Category | DamageType Battle.Struct.DamageType.Type diff --git a/src/battle/src/Update/SelectCharacter.elm b/src/battle/src/Update/SelectCharacter.elm index 8817797..9dfe73d 100644 --- a/src/battle/src/Update/SelectCharacter.elm +++ b/src/battle/src/Update/SelectCharacter.elm @@ -6,7 +6,7 @@ import Array import Task -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes -- Battle Characters ----------------------------------------------------------- import BattleCharacters.Struct.Character @@ -42,8 +42,8 @@ get_character_navigator model char = in (Struct.Navigator.new (Struct.Character.get_location char) - (Battle.Struct.Statistics.get_movement_points - (BattleCharacters.Struct.Character.get_statistics base_char) + (Battle.Struct.Attributes.get_movement_points + (BattleCharacters.Struct.Character.get_attributes base_char) ) (BattleCharacters.Struct.Weapon.get_defense_range weapon) (BattleCharacters.Struct.Weapon.get_attack_range weapon) diff --git a/src/battle/src/Update/UndoAction.elm b/src/battle/src/Update/UndoAction.elm index 23c9e89..b171d6c 100644 --- a/src/battle/src/Update/UndoAction.elm +++ b/src/battle/src/Update/UndoAction.elm @@ -4,7 +4,7 @@ module Update.UndoAction exposing (apply_to) import Array -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes -- Battle Characters ----------------------------------------------------------- import BattleCharacters.Struct.Character @@ -35,8 +35,8 @@ get_character_navigator model char = in (Struct.Navigator.new (Struct.Character.get_location char) - (Battle.Struct.Statistics.get_movement_points - (BattleCharacters.Struct.Character.get_statistics base_char) + (Battle.Struct.Attributes.get_movement_points + (BattleCharacters.Struct.Character.get_attributes base_char) ) (BattleCharacters.Struct.Weapon.get_defense_range weapon) (BattleCharacters.Struct.Weapon.get_attack_range weapon) diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm index 7484cb3..0dcde2f 100644 --- a/src/battle/src/View/Controlled/CharacterCard.elm +++ b/src/battle/src/View/Controlled/CharacterCard.elm @@ -18,10 +18,10 @@ import Util.Html -- Battle ---------------------------------------------------------------------- import Battle.Struct.DamageType import Battle.Struct.Omnimods -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.View.Gauge -import Battle.View.Statistic +import Battle.View.Attribute import Battle.View.DamageType -- Battle Characters ----------------------------------------------------------- @@ -66,8 +66,8 @@ get_health_bar char = let current = (Struct.Character.get_sane_current_health char) max = - (Battle.Struct.Statistics.get_max_health - (BattleCharacters.Struct.Character.get_statistics + (Battle.Struct.Attributes.get_max_health + (BattleCharacters.Struct.Character.get_attributes (Struct.Character.get_base_character char) ) ) @@ -80,8 +80,8 @@ get_health_bar char = (Html.Attributes.class "clickable"), (Html.Events.onClick (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic - Battle.Struct.Statistics.MaxHealth + (Struct.HelpRequest.Attribute + Battle.Struct.Attributes.MaxHealth ) ) ) @@ -139,8 +139,8 @@ get_active_movement_bar : ( get_active_movement_bar maybe_navigator char = let max = - (Battle.Struct.Statistics.get_movement_points - (BattleCharacters.Struct.Character.get_statistics + (Battle.Struct.Attributes.get_movement_points + (BattleCharacters.Struct.Character.get_attributes (Struct.Character.get_base_character char) ) ) @@ -160,8 +160,8 @@ get_active_movement_bar maybe_navigator char = (Html.Attributes.class "clickable"), (Html.Events.onClick (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic - Battle.Struct.Statistics.MovementPoints + (Struct.HelpRequest.Attribute + Battle.Struct.Attributes.MovementPoints ) ) ) @@ -177,8 +177,8 @@ get_inactive_movement_bar : ( get_inactive_movement_bar char = let max = - (Battle.Struct.Statistics.get_movement_points - (BattleCharacters.Struct.Character.get_statistics + (Battle.Struct.Attributes.get_movement_points + (BattleCharacters.Struct.Character.get_attributes (Struct.Character.get_base_character char) ) ) @@ -191,8 +191,8 @@ get_inactive_movement_bar char = (Html.Attributes.class "clickable"), (Html.Events.onClick (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic - Battle.Struct.Statistics.MovementPoints + (Struct.HelpRequest.Attribute + Battle.Struct.Attributes.MovementPoints ) ) ) @@ -417,11 +417,11 @@ get_summary_html : ( get_summary_html char_turn player_ix char = let base_char = (Struct.Character.get_base_character char) - char_statistics = - (BattleCharacters.Struct.Character.get_statistics base_char) + char_attributes = + (BattleCharacters.Struct.Character.get_attributes base_char) damage_multiplier = - (Battle.Struct.Statistics.get_damage_multiplier - char_statistics + (Battle.Struct.Attributes.get_damage_multiplier + char_attributes ) omnimods = (BattleCharacters.Struct.Character.get_omnimods base_char) equipment = (BattleCharacters.Struct.Character.get_equipment base_char) @@ -463,9 +463,9 @@ get_summary_html char_turn player_ix char = (BattleCharacters.Struct.Equipment.get_armor equipment) ), (Html.div - [(Html.Attributes.class "character-card-stats")] - (Battle.View.Statistic.get_all_but_gauges_html - char_statistics + [(Html.Attributes.class "character-card-atts")] + (Battle.View.Attribute.get_all_but_gauges_html + char_attributes ) ), (get_weapon_summary @@ -485,11 +485,11 @@ get_full_html : ( get_full_html player_ix char = let base_char = (Struct.Character.get_base_character char) - char_statistics = - (BattleCharacters.Struct.Character.get_statistics base_char) + char_attributes = + (BattleCharacters.Struct.Character.get_attributes base_char) damage_multiplier = - (Battle.Struct.Statistics.get_damage_multiplier - char_statistics + (Battle.Struct.Attributes.get_damage_multiplier + char_attributes ) omnimods = (BattleCharacters.Struct.Character.get_omnimods base_char) equipment = (BattleCharacters.Struct.Character.get_equipment base_char) @@ -532,9 +532,9 @@ get_full_html player_ix char = (BattleCharacters.Struct.Equipment.get_armor equipment) ), (Html.div - [(Html.Attributes.class "character-card-stats")] - (Battle.View.Statistic.get_all_but_gauges_html - char_statistics + [(Html.Attributes.class "character-card-atts")] + (Battle.View.Attribute.get_all_but_gauges_html + char_attributes ) ), (get_weapon_summary diff --git a/src/battle/src/View/Controlled/Targets.elm b/src/battle/src/View/Controlled/Targets.elm index 4b36f03..3457731 100644 --- a/src/battle/src/View/Controlled/Targets.elm +++ b/src/battle/src/View/Controlled/Targets.elm @@ -7,7 +7,7 @@ import Html import Html.Attributes -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes -- Local Module ---------------------------------------------------------------- import Struct.Character @@ -36,8 +36,8 @@ get_target_info_html model char_ref = ++ "): " ++ (String.fromInt - (Battle.Struct.Statistics.get_movement_points - (Struct.Character.get_statistics char) + (Battle.Struct.Attributes.get_movement_points + (Struct.Character.get_attributes char) ) ) ++ " movement points; " @@ -50,8 +50,8 @@ get_target_info_html model char_ref = ++ "/" ++ (String.fromInt - (Battle.Struct.Statistics.get_max_health - (Struct.Character.get_statistics char) + (Battle.Struct.Attributes.get_max_health + (Struct.Character.get_attributes char) ) ) ) diff --git a/src/battle/src/View/MessageBoard/Help.elm b/src/battle/src/View/MessageBoard/Help.elm index 5fcdabd..89af283 100644 --- a/src/battle/src/View/MessageBoard/Help.elm +++ b/src/battle/src/View/MessageBoard/Help.elm @@ -6,7 +6,7 @@ import Html.Attributes -- Battle ---------------------------------------------------------------------- import Battle.View.Help.DamageType -import Battle.View.Help.Statistic +import Battle.View.Help.Attribute -- Local Module ---------------------------------------------------------------- import Struct.Event @@ -38,8 +38,8 @@ get_html model = (Struct.HelpRequest.Rank rank) -> (View.MessageBoard.Help.Rank.get_html_contents rank) - (Struct.HelpRequest.Statistic stat_cat) -> - (Battle.View.Help.Statistic.get_html_contents stat_cat) + (Struct.HelpRequest.Attribute att_cat) -> + (Battle.View.Help.Attribute.get_html_contents att_cat) (Struct.HelpRequest.DamageType dmg_cat) -> (Battle.View.Help.DamageType.get_html_contents dmg_cat) diff --git a/src/battle/src/View/MessageBoard/Help/Guide.elm b/src/battle/src/View/MessageBoard/Help/Guide.elm index deb5190..d60dd6b 100644 --- a/src/battle/src/View/MessageBoard/Help/Guide.elm +++ b/src/battle/src/View/MessageBoard/Help/Guide.elm @@ -87,7 +87,7 @@ get_default_html_contents = (Html.text ( "Click once on a character to focus them. This will show you" - ++ " their stats, equipment, and other infos. If they are in" + ++ " their attributes, equipment, and other infos. If they are in" ++ " your team and active (the pulsating characters)," ++ " clicking on them again will let you take control." ) diff --git a/src/css/src/shared/battle-characters/info-card.scss b/src/css/src/shared/battle-characters/info-card.scss index d36e204..2ef980f 100644 --- a/src/css/src/shared/battle-characters/info-card.scss +++ b/src/css/src/shared/battle-characters/info-card.scss @@ -115,14 +115,14 @@ margin-top: 0.3em; } -.character-card-armor-stats +.character-card-armor-atts { display: flex; flex-direction: row; flex-wrap: wrap; } -.character-card-stats +.character-card-atts { display: flex; flex-direction: row; @@ -151,11 +151,8 @@ display: inline-block; } -.character-card-stats, .character-card-atts, -.character-card-stats > *, .character-card-atts > * - { display: flex; flex-direction: row; diff --git a/src/css/src/shared/omnimod-icons.scss b/src/css/src/shared/omnimod-icons.scss index 0abacab..32835dc 100644 --- a/src/css/src/shared/omnimod-icons.scss +++ b/src/css/src/shared/omnimod-icons.scss @@ -154,11 +154,9 @@ .omnimod-attack-mods, .omnimod-defense-mods, .omnimod-attribute-mods, -.omnimod-statistics-mods, .omnimod-attack-mods > *, .omnimod-defense-mods > *, -.omnimod-attribute-mods > *, -.omnimod-statistics-mods >* +.omnimod-attribute-mods > * { display: flex; flex-wrap: wrap; diff --git a/src/map-editor/src/Struct/HelpRequest.elm b/src/map-editor/src/Struct/HelpRequest.elm index 5bfa96f..a8f8a20 100644 --- a/src/map-editor/src/Struct/HelpRequest.elm +++ b/src/map-editor/src/Struct/HelpRequest.elm @@ -1,7 +1,7 @@ module Struct.HelpRequest exposing (Type(..)) -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.Struct.DamageType -------------------------------------------------------------------------------- @@ -9,5 +9,5 @@ import Battle.Struct.DamageType -------------------------------------------------------------------------------- type Type = None - | Statistic Battle.Struct.Statistics.Category + | Attribute Battle.Struct.Attributes.Category | DamageType Battle.Struct.DamageType.Type diff --git a/src/map-editor/src/View/MessageBoard/Help.elm b/src/map-editor/src/View/MessageBoard/Help.elm index 49b5b99..e615b55 100644 --- a/src/map-editor/src/View/MessageBoard/Help.elm +++ b/src/map-editor/src/View/MessageBoard/Help.elm @@ -6,7 +6,7 @@ import Html.Attributes -- Battle ---------------------------------------------------------------------- import Battle.View.Help.DamageType -import Battle.View.Help.Statistic +import Battle.View.Help.Attribute -- Local Module ---------------------------------------------------------------- import Struct.Event @@ -31,8 +31,8 @@ get_html model = ] ( case model.help_request of - (Struct.HelpRequest.Statistic stat_cat) -> - (Battle.View.Help.Statistic.get_html_contents stat_cat) + (Struct.HelpRequest.Attribute att_cat) -> + (Battle.View.Help.Attribute.get_html_contents att_cat) (Struct.HelpRequest.DamageType dmg_cat) -> (Battle.View.Help.DamageType.get_html_contents dmg_cat) diff --git a/src/map-editor/src/View/SubMenu/TileStatus.elm b/src/map-editor/src/View/SubMenu/TileStatus.elm index bc278b0..0ef4590 100644 --- a/src/map-editor/src/View/SubMenu/TileStatus.elm +++ b/src/map-editor/src/View/SubMenu/TileStatus.elm @@ -153,9 +153,9 @@ get_omnimods omnimods = (Html.Attributes.class "info-card-omnimods") ] [ - (Html.text "Statistics Modifiers"), + (Html.text "Attributes Modifiers"), (get_omnimods_listing - (Battle.Struct.Omnimods.get_statistics_mods omnimods) + (Battle.Struct.Omnimods.get_attribute_mods omnimods) ), (Html.text "Attack Modifiers"), (get_omnimods_listing diff --git a/src/roster-editor/src/Struct/HelpRequest.elm b/src/roster-editor/src/Struct/HelpRequest.elm index 5bfa96f..a8f8a20 100644 --- a/src/roster-editor/src/Struct/HelpRequest.elm +++ b/src/roster-editor/src/Struct/HelpRequest.elm @@ -1,7 +1,7 @@ module Struct.HelpRequest exposing (Type(..)) -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.Struct.DamageType -------------------------------------------------------------------------------- @@ -9,5 +9,5 @@ import Battle.Struct.DamageType -------------------------------------------------------------------------------- type Type = None - | Statistic Battle.Struct.Statistics.Category + | Attribute Battle.Struct.Attributes.Category | DamageType Battle.Struct.DamageType.Type diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm index 8a0eb71..8dc985f 100644 --- a/src/roster-editor/src/View/CharacterCard.elm +++ b/src/roster-editor/src/View/CharacterCard.elm @@ -13,10 +13,10 @@ import Html.Events -- Battle ---------------------------------------------------------------------- import Battle.Struct.Omnimods -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.View.Omnimods -import Battle.View.Statistic +import Battle.View.Attribute -- Battle Characters ----------------------------------------------------------- import BattleCharacters.Struct.Armor @@ -70,13 +70,13 @@ get_name base_char can_edit = ] ) -get_health_bar : Battle.Struct.Statistics.Type -> (Html.Html Struct.Event.Type) -get_health_bar char_stats = +get_health_bar : Battle.Struct.Attributes.Type -> (Html.Html Struct.Event.Type) +get_health_bar char_atts = (View.Gauge.get_html ( "HP: " ++ - (String.fromInt (Battle.Struct.Statistics.get_max_health char_stats)) + (String.fromInt (Battle.Struct.Attributes.get_max_health char_atts)) ) 100.0 [ @@ -84,7 +84,7 @@ get_health_bar char_stats = (Html.Attributes.class "clickable"), (Html.Events.onClick (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic Battle.Struct.Statistics.MaxHealth) + (Struct.HelpRequest.Attribute Battle.Struct.Attributes.MaxHealth) ) ) ] @@ -106,16 +106,16 @@ get_statuses char = ) get_movement_bar : ( - Battle.Struct.Statistics.Type -> + Battle.Struct.Attributes.Type -> (Html.Html Struct.Event.Type) ) -get_movement_bar char_stats = +get_movement_bar char_atts = (View.Gauge.get_html ( "MP: " ++ (String.fromInt - (Battle.Struct.Statistics.get_movement_points char_stats) + (Battle.Struct.Attributes.get_movement_points char_atts) ) ) 100.0 @@ -124,8 +124,8 @@ get_movement_bar char_stats = (Html.Attributes.class "clickable"), (Html.Events.onClick (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic - Battle.Struct.Statistics.MovementPoints + (Struct.HelpRequest.Attribute + Battle.Struct.Attributes.MovementPoints ) ) ) @@ -365,17 +365,17 @@ get_glyph_board_details damage_multiplier board = ] ) -get_relevant_stats : ( - Battle.Struct.Statistics.Type -> +get_relevant_atts : ( + Battle.Struct.Attributes.Type -> (Html.Html Struct.Event.Type) ) -get_relevant_stats stats = +get_relevant_atts atts = (Html.div [ - (Html.Attributes.class "character-card-stats"), + (Html.Attributes.class "character-card-atts"), (Html.Attributes.class "clickable") ] - (Battle.View.Statistic.get_all_but_gauges_html stats) + (Battle.View.Attribute.get_all_but_gauges_html atts) ) -------------------------------------------------------------------------------- @@ -385,8 +385,8 @@ get_minimal_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) get_minimal_html char = let base_char = (Struct.Character.get_base_character char) - char_statistics = - (BattleCharacters.Struct.Character.get_statistics base_char) + char_attributes = + (BattleCharacters.Struct.Character.get_attributes base_char) in (Html.div [ @@ -416,8 +416,8 @@ get_minimal_html char = (View.Character.get_portrait_html True char) ] ), - (get_health_bar char_statistics), - (get_movement_bar char_statistics), + (get_health_bar char_attributes), + (get_movement_bar char_attributes), (get_statuses char) ] ) @@ -428,11 +428,11 @@ get_full_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) get_full_html char = let base_char = (Struct.Character.get_base_character char) - char_statistics = - (BattleCharacters.Struct.Character.get_statistics base_char) + char_attributes = + (BattleCharacters.Struct.Character.get_attributes base_char) damage_multiplier = - (Battle.Struct.Statistics.get_damage_multiplier - char_statistics + (Battle.Struct.Attributes.get_damage_multiplier + char_attributes ) omnimods = (BattleCharacters.Struct.Character.get_omnimods base_char) equipment = (BattleCharacters.Struct.Character.get_equipment base_char) @@ -466,8 +466,8 @@ get_full_html char = (View.Character.get_portrait_html False char) ] ), - (get_health_bar char_statistics), - (get_movement_bar char_statistics), + (get_health_bar char_attributes), + (get_movement_bar char_attributes), (get_statuses char) ] ), @@ -484,7 +484,7 @@ get_full_html char = damage_multiplier (BattleCharacters.Struct.Equipment.get_glyph_board equipment) ), - (get_relevant_stats char_statistics), + (get_relevant_atts char_attributes), (get_weapon_details damage_multiplier (BattleCharacters.Struct.Equipment.get_secondary_weapon diff --git a/src/roster-editor/src/View/MessageBoard/Help.elm b/src/roster-editor/src/View/MessageBoard/Help.elm index b6d29a2..02edb70 100644 --- a/src/roster-editor/src/View/MessageBoard/Help.elm +++ b/src/roster-editor/src/View/MessageBoard/Help.elm @@ -6,7 +6,7 @@ import Html.Attributes -- Battle ---------------------------------------------------------------------- import Battle.View.Help.DamageType -import Battle.View.Help.Statistic +import Battle.View.Help.Attribute -- Local Module ---------------------------------------------------------------- import Struct.Event @@ -34,8 +34,8 @@ get_html model = Struct.HelpRequest.None -> (View.MessageBoard.Help.Guide.get_html_contents model) - (Struct.HelpRequest.Statistic stat_cat) -> - (Battle.View.Help.Statistic.get_html_contents stat_cat) + (Struct.HelpRequest.Attribute att_cat) -> + (Battle.View.Help.Attribute.get_html_contents att_cat) (Struct.HelpRequest.DamageType dmg_cat) -> (Battle.View.Help.DamageType.get_html_contents dmg_cat) diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm index ce74b59..0023b5b 100644 --- a/src/shared/battle-characters/BattleCharacters/Struct/Character.elm +++ b/src/shared/battle-characters/BattleCharacters/Struct/Character.elm @@ -10,7 +10,7 @@ module BattleCharacters.Struct.Character exposing get_omnimods, set_extra_omnimods, dirty_set_extra_omnimods, - get_statistics, + get_attributes, get_active_weapon, get_inactive_weapon, is_using_secondary, @@ -30,7 +30,7 @@ import Json.Encode -- Battle ---------------------------------------------------------------------- import Battle.Struct.Omnimods -import Battle.Struct.Statistics +import Battle.Struct.Attributes -- Battle Characters ----------------------------------------------------------- import BattleCharacters.Struct.Armor @@ -45,7 +45,7 @@ type alias Type = { name : String, equipment : BattleCharacters.Struct.Equipment.Type, - statistics : Battle.Struct.Statistics.Type, + attributes : Battle.Struct.Attributes.Type, is_using_secondary : Bool, omnimods : Battle.Struct.Omnimods.Type, extra_omnimods : Battle.Struct.Omnimods.Type @@ -83,14 +83,14 @@ refresh_omnimods char = (BattleCharacters.Struct.Equipment.get_glyph_board equipment) ) ) - statistics = - (Battle.Struct.Omnimods.apply_to_statistics + attributes = + (Battle.Struct.Omnimods.apply_to_attributes omnimods - (Battle.Struct.Statistics.default) + (Battle.Struct.Attributes.default) ) in {char | - statistics = statistics, + attributes = attributes, omnimods = omnimods } @@ -134,8 +134,8 @@ set_extra_omnimods om char = (refresh_omnimods {char | extra_omnimods = om}) dirty_set_extra_omnimods : Battle.Struct.Omnimods.Type -> Type -> Type dirty_set_extra_omnimods om char = {char | extra_omnimods = om} -get_statistics : Type -> Battle.Struct.Statistics.Type -get_statistics char = char.statistics +get_attributes : Type -> Battle.Struct.Attributes.Type +get_attributes char = char.attributes is_using_secondary : Type -> Bool is_using_secondary char = char.is_using_secondary @@ -196,7 +196,7 @@ resolve resolve_equipment extra_omnimods ref = { name = ref.name, equipment = (resolve_equipment ref.equipment), - statistics = (Battle.Struct.Statistics.default), + attributes = (Battle.Struct.Attributes.default), is_using_secondary = ref.is_using_secondary, omnimods = (Battle.Struct.Omnimods.none), extra_omnimods = extra_omnimods diff --git a/src/shared/battle/Battle/Lang/English.elm b/src/shared/battle/Battle/Lang/English.elm index 2568260..d8b0254 100644 --- a/src/shared/battle/Battle/Lang/English.elm +++ b/src/shared/battle/Battle/Lang/English.elm @@ -6,7 +6,7 @@ import Html.Attributes import Html.Events -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.Struct.DamageType -- Local Module ---------------------------------------------------------------- @@ -64,7 +64,7 @@ base : String base = "Universal Damage" -- Help ------------------------------------------------------------------------ ----- Statistics ---------------------------------------------------------------- +---- Attributes ---------------------------------------------------------------- max_health_help : (Html.Html Struct.Event.Type) max_health_help = (Html.div @@ -108,7 +108,7 @@ dodges_help = the opponent's """ ), - (get_stats_reference_html Battle.Struct.Statistics.Accuracy), + (get_atts_reference_html Battle.Struct.Attributes.Accuracy), (Html.text """. Multiply by two to get the chance of at least avoiding partially (taking only half damage) an attack. @@ -142,7 +142,7 @@ accuracy_help = (Html.text "Accuracy lowers the target's chance to evade an incoming blow (" ), - (get_stats_reference_html Battle.Struct.Statistics.Dodges), + (get_atts_reference_html Battle.Struct.Attributes.Dodges), (Html.text ").") ] ) @@ -192,17 +192,17 @@ damage_modifier_help = ] ) -get_stats_reference_html : ( - Battle.Struct.Statistics.Category -> +get_atts_reference_html : ( + Battle.Struct.Attributes.Category -> (Html.Html Struct.Event.Type) ) -get_stats_reference_html cat = +get_atts_reference_html cat = (Html.div [ (Html.Attributes.class "tooltip-reference"), (Html.Events.onClick (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic cat) + (Struct.HelpRequest.Attribute cat) ) ) ] @@ -213,14 +213,14 @@ get_stats_reference_html cat = (Html.Attributes.class ( "omnimod-icon-" - ++ (Battle.Struct.Statistics.encode_category cat) + ++ (Battle.Struct.Attributes.encode_category cat) ) ) ] [ ] ), - (Html.text (get_statistic_name cat)) + (Html.text (get_attribute_name cat)) ] ) @@ -267,46 +267,46 @@ base_help = ] ) -get_statistic_name : Battle.Struct.Statistics.Category -> String -get_statistic_name cat = +get_attribute_name : Battle.Struct.Attributes.Category -> String +get_attribute_name cat = case cat of - Battle.Struct.Statistics.MaxHealth -> (max_health) - Battle.Struct.Statistics.MovementPoints -> (movement_points) - Battle.Struct.Statistics.Dodges -> (dodges) - Battle.Struct.Statistics.Parries -> (parries) - Battle.Struct.Statistics.Accuracy -> (accuracy) - Battle.Struct.Statistics.DoubleHits -> (double_hits) - Battle.Struct.Statistics.CriticalHits -> (critical_hits) - Battle.Struct.Statistics.DamageModifier -> (damage_modifier) - -get_statistic_category_help : ( - Battle.Struct.Statistics.Category -> + Battle.Struct.Attributes.MaxHealth -> (max_health) + Battle.Struct.Attributes.MovementPoints -> (movement_points) + Battle.Struct.Attributes.Dodges -> (dodges) + Battle.Struct.Attributes.Parries -> (parries) + Battle.Struct.Attributes.Accuracy -> (accuracy) + Battle.Struct.Attributes.DoubleHits -> (double_hits) + Battle.Struct.Attributes.CriticalHits -> (critical_hits) + Battle.Struct.Attributes.DamageModifier -> (damage_modifier) + +get_attribute_category_help : ( + Battle.Struct.Attributes.Category -> (String, (Html.Html Struct.Event.Type)) ) -get_statistic_category_help cat = +get_attribute_category_help cat = case cat of - Battle.Struct.Statistics.MaxHealth -> + Battle.Struct.Attributes.MaxHealth -> ((max_health), (max_health_help)) - Battle.Struct.Statistics.MovementPoints -> + Battle.Struct.Attributes.MovementPoints -> ((movement_points), (movement_points_help)) - Battle.Struct.Statistics.Dodges -> + Battle.Struct.Attributes.Dodges -> ((dodges), (dodges_help)) - Battle.Struct.Statistics.Parries -> + Battle.Struct.Attributes.Parries -> ((parries), (parries_help)) - Battle.Struct.Statistics.Accuracy -> + Battle.Struct.Attributes.Accuracy -> ((accuracy), (accuracy_help)) - Battle.Struct.Statistics.DoubleHits -> + Battle.Struct.Attributes.DoubleHits -> ((double_hits), (double_hits_help)) - Battle.Struct.Statistics.CriticalHits -> + Battle.Struct.Attributes.CriticalHits -> ((critical_hits), (critical_hits_help)) - Battle.Struct.Statistics.DamageModifier -> + Battle.Struct.Attributes.DamageModifier -> ((damage_modifier), (damage_modifier_help)) get_damage_type_help : ( diff --git a/src/shared/battle/Battle/Struct/Attributes.elm b/src/shared/battle/Battle/Struct/Attributes.elm new file mode 100644 index 0000000..159404e --- /dev/null +++ b/src/shared/battle/Battle/Struct/Attributes.elm @@ -0,0 +1,162 @@ +module Battle.Struct.Attributes exposing + ( + Type, + Category(..), + get_movement_points, + get_max_health, + get_dodges, + get_parries, + get_accuracy, + get_double_hits, + get_critical_hits, + get_damage_modifier, + get_damage_multiplier, + decode_category, + encode_category, + mod, + default, + is_percent + ) + +-- Elm ------------------------------------------------------------------------- +import List + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type Category = + MovementPoints + | MaxHealth + | Dodges + | Parries + | Accuracy + | DoubleHits + | CriticalHits + | DamageModifier + +type alias Type = + { + movement_points : Int, + max_health : Int, + dodges : Int, + parries : Int, + accuracy : Int, + double_hits : Int, + critical_hits : Int, + damage_modifier : Int + } + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +mod_movement_points : Int -> Type -> Type +mod_movement_points v t = + {t | + movement_points = (t.movement_points + v) + } + +mod_max_health : Int -> Type -> Type +mod_max_health v t = + {t | + max_health = (t.max_health + v) + } + +mod_dodges : Int -> Type -> Type +mod_dodges v t = {t | dodges = (t.dodges + v)} + +mod_parries : Int -> Type -> Type +mod_parries v t = {t | parries = (t.parries + v)} + +mod_accuracy : Int -> Type -> Type +mod_accuracy v t = {t | accuracy = (t.accuracy + v)} + +mod_double_hits : Int -> Type -> Type +mod_double_hits v t = {t | double_hits = (t.double_hits + v)} + +mod_critical_hits : Int -> Type -> Type +mod_critical_hits v t = {t | critical_hits = (t.critical_hits + v)} + +mod_damage_modifier : Int -> Type -> Type +mod_damage_modifier v t = {t | damage_modifier = (t.damage_modifier + v)} + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_movement_points : Type -> Int +get_movement_points t = (max 0 t.movement_points) + +get_max_health : Type -> Int +get_max_health t = (max 1 t.max_health) + +get_dodges : Type -> Int +get_dodges t = (max 0 t.dodges) + +get_parries : Type -> Int +get_parries t = (max 0 t.parries) + +get_accuracy : Type -> Int +get_accuracy t = (max 0 t.accuracy) + +get_double_hits : Type -> Int +get_double_hits t = (max 0 t.double_hits) + +get_critical_hits : Type -> Int +get_critical_hits t = (max 0 t.critical_hits) + +get_damage_modifier : Type -> Int +get_damage_modifier t = (max 0 t.damage_modifier) + +get_damage_multiplier : Type -> Float +get_damage_multiplier t = ((toFloat (max 0 t.damage_modifier)) / 100.0) + +mod : Category -> Int -> Type -> Type +mod cat v t = + case cat of + MaxHealth -> (mod_max_health v t) + MovementPoints -> (mod_movement_points v t) + Dodges -> (mod_dodges v t) + Parries -> (mod_parries v t) + Accuracy -> (mod_accuracy v t) + DoubleHits -> (mod_double_hits v t) + CriticalHits -> (mod_critical_hits v t) + DamageModifier -> (mod_damage_modifier v t) + +default : Type +default = + { + movement_points = 0, + max_health = 1, + dodges = 0, + parries = 0, + accuracy = 0, + double_hits = 0, + critical_hits = 0, + damage_modifier = 100 + } + +decode_category : String -> Category +decode_category str = + case str of + "mheal" -> MaxHealth + "mpts" -> MovementPoints + "dodg" -> Dodges + "pary" -> Parries + "accu" -> Accuracy + "dhit" -> DoubleHits + "dmgm" -> DamageModifier + _ -> CriticalHits + +encode_category : Category -> String +encode_category cat = + case cat of + MaxHealth -> "mheal" + MovementPoints -> "mpts" + Dodges -> "dodg" + Parries -> "pary" + Accuracy -> "accu" + DoubleHits -> "dhit" + CriticalHits -> "crit" + DamageModifier -> "dmgm" + +is_percent : Category -> Bool +is_percent cat = ((cat /= MaxHealth) && (cat /= MovementPoints)) diff --git a/src/shared/battle/Battle/Struct/Omnimods.elm b/src/shared/battle/Battle/Struct/Omnimods.elm index 92bf636..7a61153 100644 --- a/src/shared/battle/Battle/Struct/Omnimods.elm +++ b/src/shared/battle/Battle/Struct/Omnimods.elm @@ -4,10 +4,10 @@ module Battle.Struct.Omnimods exposing new, merge, none, - apply_to_statistics, + apply_to_attributes, get_attack_damage, get_damage_sum, - get_statistics_mods, + get_attribute_mods, get_attack_mods, get_defense_mods, get_all_mods, @@ -22,7 +22,7 @@ import Json.Decode import Json.Decode.Pipeline -- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.Struct.DamageType -------------------------------------------------------------------------------- @@ -30,7 +30,7 @@ import Battle.Struct.DamageType -------------------------------------------------------------------------------- type alias Type = { - statistics : (Dict.Dict String Int), + attributes : (Dict.Dict String Int), attack : (Dict.Dict String Int), defense : (Dict.Dict String Int) } @@ -84,7 +84,7 @@ decoder : (Json.Decode.Decoder Type) decoder = (Json.Decode.succeed Type - |> (Json.Decode.Pipeline.required "stam" generic_mods_decoder) + |> (Json.Decode.Pipeline.required "attm" generic_mods_decoder) |> (Json.Decode.Pipeline.required "atkm" generic_mods_decoder) |> (Json.Decode.Pipeline.required "defm" generic_mods_decoder) ) @@ -95,9 +95,9 @@ new : ( (List (String, Int)) -> Type ) -new statistic_mods attack_mods defense_mods = +new attribute_mods attack_mods defense_mods = { - statistics = (Dict.fromList statistic_mods), + attributes = (Dict.fromList attribute_mods), attack = (Dict.fromList attack_mods), defense = (Dict.fromList defense_mods) } @@ -105,7 +105,7 @@ new statistic_mods attack_mods defense_mods = none : Type none = { - statistics = (Dict.empty), + attributes = (Dict.empty), attack = (Dict.empty), defense = (Dict.empty) } @@ -113,24 +113,24 @@ none = merge : Type -> Type -> Type merge omni_a omni_b = { - statistics = (merge_mods omni_a.statistics omni_b.statistics), + attributes = (merge_mods omni_a.attributes omni_b.attributes), attack = (merge_mods omni_a.attack omni_b.attack), defense = (merge_mods omni_a.defense omni_b.defense) } -apply_to_statistics : ( +apply_to_attributes : ( Type -> - Battle.Struct.Statistics.Type -> - Battle.Struct.Statistics.Type + Battle.Struct.Attributes.Type -> + Battle.Struct.Attributes.Type ) -apply_to_statistics omnimods statistics = +apply_to_attributes omnimods attributes = (Dict.foldl ( - (Battle.Struct.Statistics.decode_category) - >> (Battle.Struct.Statistics.mod) + (Battle.Struct.Attributes.decode_category) + >> (Battle.Struct.Attributes.mod) ) - statistics - omnimods.statistics + attributes + omnimods.attributes ) get_damage_sum : Type -> Int @@ -177,14 +177,14 @@ get_attack_damage dmg_modifier atk_omni def_omni = scale : Float -> Type -> Type scale multiplier omnimods = {omnimods | - statistics = (Dict.map (scale_dict_value multiplier) omnimods.statistics), + attributes = (Dict.map (scale_dict_value multiplier) omnimods.attributes), attack = (Dict.map (scale_dict_value multiplier) omnimods.attack), defense = (Dict.map (scale_dict_value multiplier) omnimods.defense) } -get_statistics_mods : Type -> (List (String, Int)) -get_statistics_mods omnimods = (Dict.toList omnimods.statistics) +get_attribute_mods : Type -> (List (String, Int)) +get_attribute_mods omnimods = (Dict.toList omnimods.attributes) get_attack_mods : Type -> (List (String, Int)) get_attack_mods omnimods = (Dict.toList omnimods.attack) @@ -195,7 +195,7 @@ get_defense_mods omnimods = (Dict.toList omnimods.defense) get_all_mods : Type -> (List (String, Int)) get_all_mods omnimods = ( - (get_statistics_mods omnimods) + (get_attribute_mods omnimods) ++ (get_attack_mods omnimods) ++ (get_defense_mods omnimods) ) diff --git a/src/shared/battle/Battle/Struct/Statistics.elm b/src/shared/battle/Battle/Struct/Statistics.elm deleted file mode 100644 index 8ed145a..0000000 --- a/src/shared/battle/Battle/Struct/Statistics.elm +++ /dev/null @@ -1,162 +0,0 @@ -module Battle.Struct.Statistics exposing - ( - Type, - Category(..), - get_movement_points, - get_max_health, - get_dodges, - get_parries, - get_accuracy, - get_double_hits, - get_critical_hits, - get_damage_modifier, - get_damage_multiplier, - decode_category, - encode_category, - mod, - default, - is_percent - ) - --- Elm ------------------------------------------------------------------------- -import List - --------------------------------------------------------------------------------- --- TYPES ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -type Category = - MovementPoints - | MaxHealth - | Dodges - | Parries - | Accuracy - | DoubleHits - | CriticalHits - | DamageModifier - -type alias Type = - { - movement_points : Int, - max_health : Int, - dodges : Int, - parries : Int, - accuracy : Int, - double_hits : Int, - critical_hits : Int, - damage_modifier : Int - } - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -mod_movement_points : Int -> Type -> Type -mod_movement_points v t = - {t | - movement_points = (t.movement_points + v) - } - -mod_max_health : Int -> Type -> Type -mod_max_health v t = - {t | - max_health = (t.max_health + v) - } - -mod_dodges : Int -> Type -> Type -mod_dodges v t = {t | dodges = (t.dodges + v)} - -mod_parries : Int -> Type -> Type -mod_parries v t = {t | parries = (t.parries + v)} - -mod_accuracy : Int -> Type -> Type -mod_accuracy v t = {t | accuracy = (t.accuracy + v)} - -mod_double_hits : Int -> Type -> Type -mod_double_hits v t = {t | double_hits = (t.double_hits + v)} - -mod_critical_hits : Int -> Type -> Type -mod_critical_hits v t = {t | critical_hits = (t.critical_hits + v)} - -mod_damage_modifier : Int -> Type -> Type -mod_damage_modifier v t = {t | damage_modifier = (t.damage_modifier + v)} - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_movement_points : Type -> Int -get_movement_points t = (max 0 t.movement_points) - -get_max_health : Type -> Int -get_max_health t = (max 1 t.max_health) - -get_dodges : Type -> Int -get_dodges t = (max 0 t.dodges) - -get_parries : Type -> Int -get_parries t = (max 0 t.parries) - -get_accuracy : Type -> Int -get_accuracy t = (max 0 t.accuracy) - -get_double_hits : Type -> Int -get_double_hits t = (max 0 t.double_hits) - -get_critical_hits : Type -> Int -get_critical_hits t = (max 0 t.critical_hits) - -get_damage_modifier : Type -> Int -get_damage_modifier t = (max 0 t.damage_modifier) - -get_damage_multiplier : Type -> Float -get_damage_multiplier t = ((toFloat (max 0 t.damage_modifier)) / 100.0) - -mod : Category -> Int -> Type -> Type -mod cat v t = - case cat of - MaxHealth -> (mod_max_health v t) - MovementPoints -> (mod_movement_points v t) - Dodges -> (mod_dodges v t) - Parries -> (mod_parries v t) - Accuracy -> (mod_accuracy v t) - DoubleHits -> (mod_double_hits v t) - CriticalHits -> (mod_critical_hits v t) - DamageModifier -> (mod_damage_modifier v t) - -default : Type -default = - { - movement_points = 0, - max_health = 1, - dodges = 0, - parries = 0, - accuracy = 0, - double_hits = 0, - critical_hits = 0, - damage_modifier = 100 - } - -decode_category : String -> Category -decode_category str = - case str of - "mheal" -> MaxHealth - "mpts" -> MovementPoints - "dodg" -> Dodges - "pary" -> Parries - "accu" -> Accuracy - "dhit" -> DoubleHits - "dmgm" -> DamageModifier - _ -> CriticalHits - -encode_category : Category -> String -encode_category cat = - case cat of - MaxHealth -> "mheal" - MovementPoints -> "mpts" - Dodges -> "dodg" - Parries -> "pary" - Accuracy -> "accu" - DoubleHits -> "dhit" - CriticalHits -> "crit" - DamageModifier -> "dmgm" - -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 new file mode 100644 index 0000000..ae2edf3 --- /dev/null +++ b/src/shared/battle/Battle/View/Attribute.elm @@ -0,0 +1,259 @@ +module Battle.View.Attribute exposing + ( + get_html, + get_all_html, + get_all_but_gauges_html, + get_signed_html, + get_all_signed_html, + get_all_but_gauges_signed_html + ) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes +import Html.Events + +-- Battle ---------------------------------------------------------------------- +import Battle.Struct.Attributes + +-- Local Module ---------------------------------------------------------------- +import Struct.Event +import Struct.HelpRequest + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + Battle.Struct.Attributes.Category -> + Int -> + (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.Attributes.encode_category attribute) + ) + ) + ] + [ + ] + ), + (Html.div + [ + (Html.Attributes.class "omnimod-value") + ] + [ + (Html.text + ( + if (Battle.Struct.Attributes.is_percent attribute) + then ((String.fromInt value) ++ "%") + else (String.fromInt value) + ) + ) + ] + ) + ] + ) + +get_signed_html : ( + Battle.Struct.Attributes.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.Attributes.encode_category attribute) + ) + ) + ] + [ + ] + ), + (Html.div + [ + (Html.Attributes.class "omnimod-value") + ] + [ + (Html.text + ( + ( + if (value > 0) + then ("+" ++ (String.fromInt value)) + else (String.fromInt value) + ) + ++ + ( + if (Battle.Struct.Attributes.is_percent attribute) + then "%" + else "" + ) + ) + ) + ] + ) + ] + ) + +get_all_html : ( + Battle.Struct.Attributes.Type -> + (List (Html.Html Struct.Event.Type)) + ) +get_all_html atts = + [ + (get_html + Battle.Struct.Attributes.Dodges + (Battle.Struct.Attributes.get_dodges atts) + ), + (get_html + Battle.Struct.Attributes.Parries + (Battle.Struct.Attributes.get_parries atts) + ), + (get_html + Battle.Struct.Attributes.Accuracy + (Battle.Struct.Attributes.get_accuracy atts) + ), + (get_html + Battle.Struct.Attributes.DoubleHits + (Battle.Struct.Attributes.get_double_hits atts) + ), + (get_html + Battle.Struct.Attributes.CriticalHits + (Battle.Struct.Attributes.get_critical_hits atts) + ), + (get_html + Battle.Struct.Attributes.MaxHealth + (Battle.Struct.Attributes.get_max_health atts) + ), + (get_html + Battle.Struct.Attributes.MovementPoints + (Battle.Struct.Attributes.get_movement_points 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.Dodges + (Battle.Struct.Attributes.get_dodges atts) + ), + (get_signed_html + Battle.Struct.Attributes.Parries + (Battle.Struct.Attributes.get_parries atts) + ), + (get_signed_html + Battle.Struct.Attributes.Accuracy + (Battle.Struct.Attributes.get_accuracy atts) + ), + (get_signed_html + Battle.Struct.Attributes.DoubleHits + (Battle.Struct.Attributes.get_double_hits atts) + ), + (get_signed_html + Battle.Struct.Attributes.CriticalHits + (Battle.Struct.Attributes.get_critical_hits atts) + ), + (get_signed_html + Battle.Struct.Attributes.MaxHealth + (Battle.Struct.Attributes.get_max_health atts) + ), + (get_signed_html + Battle.Struct.Attributes.MovementPoints + (Battle.Struct.Attributes.get_movement_points atts) + ) + ] + +get_all_but_gauges_html : ( + Battle.Struct.Attributes.Type -> + (List (Html.Html Struct.Event.Type)) + ) +get_all_but_gauges_html atts = + [ + (get_html + Battle.Struct.Attributes.Dodges + (Battle.Struct.Attributes.get_dodges atts) + ), + (get_html + Battle.Struct.Attributes.Parries + (Battle.Struct.Attributes.get_parries atts) + ), + (get_html + Battle.Struct.Attributes.Accuracy + (Battle.Struct.Attributes.get_accuracy atts) + ), + (get_html + Battle.Struct.Attributes.DoubleHits + (Battle.Struct.Attributes.get_double_hits atts) + ), + (get_html + Battle.Struct.Attributes.CriticalHits + (Battle.Struct.Attributes.get_critical_hits atts) + ) + ] + +get_all_but_gauges_signed_html : ( + Battle.Struct.Attributes.Type -> + (List (Html.Html Struct.Event.Type)) + ) +get_all_but_gauges_signed_html atts = + [ + (get_signed_html + Battle.Struct.Attributes.Dodges + (Battle.Struct.Attributes.get_dodges atts) + ), + (get_signed_html + Battle.Struct.Attributes.Parries + (Battle.Struct.Attributes.get_parries atts) + ), + (get_signed_html + Battle.Struct.Attributes.Accuracy + (Battle.Struct.Attributes.get_accuracy atts) + ), + (get_signed_html + Battle.Struct.Attributes.DoubleHits + (Battle.Struct.Attributes.get_double_hits atts) + ), + (get_signed_html + Battle.Struct.Attributes.CriticalHits + (Battle.Struct.Attributes.get_critical_hits atts) + ) + ] diff --git a/src/shared/battle/Battle/View/Help/Attribute.elm b/src/shared/battle/Battle/View/Help/Attribute.elm new file mode 100644 index 0000000..f7bd9e1 --- /dev/null +++ b/src/shared/battle/Battle/View/Help/Attribute.elm @@ -0,0 +1,62 @@ +module Battle.View.Help.Attribute exposing (get_html_contents) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Battle ---------------------------------------------------------------------- +import Battle.Struct.Attributes +import Battle.Lang.English + +-- Local Module ---------------------------------------------------------------- +import Struct.Event + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_header_html : ( + Battle.Struct.Attributes.Category -> + String -> + (Html.Html Struct.Event.Type) + ) +get_header_html cat name = + (Html.h1 + [] + [ + (Html.div + [(Html.Attributes.class "help-guide-icon")] + [] + ), + (Html.text " "), + (Html.div + [ + (Html.Attributes.class "omnimod-icon"), + (Html.Attributes.class + ( + "omnimod-icon-" + ++ (Battle.Struct.Attributes.encode_category cat) + ) + ) + ] + [ + ] + ), + (Html.text name) + ] + ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html_contents : ( + Battle.Struct.Attributes.Category -> + (List (Html.Html Struct.Event.Type)) + ) +get_html_contents cat = + let + (name, tooltip) = (Battle.Lang.English.get_attribute_category_help cat) + in + [ + (get_header_html cat name), + tooltip + ] diff --git a/src/shared/battle/Battle/View/Help/Statistic.elm b/src/shared/battle/Battle/View/Help/Statistic.elm deleted file mode 100644 index 0e1f056..0000000 --- a/src/shared/battle/Battle/View/Help/Statistic.elm +++ /dev/null @@ -1,62 +0,0 @@ -module Battle.View.Help.Statistic exposing (get_html_contents) - --- Elm ------------------------------------------------------------------------- -import Html -import Html.Attributes - --- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics -import Battle.Lang.English - --- Local Module ---------------------------------------------------------------- -import Struct.Event - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_header_html : ( - Battle.Struct.Statistics.Category -> - String -> - (Html.Html Struct.Event.Type) - ) -get_header_html cat name = - (Html.h1 - [] - [ - (Html.div - [(Html.Attributes.class "help-guide-icon")] - [] - ), - (Html.text " "), - (Html.div - [ - (Html.Attributes.class "omnimod-icon"), - (Html.Attributes.class - ( - "omnimod-icon-" - ++ (Battle.Struct.Statistics.encode_category cat) - ) - ) - ] - [ - ] - ), - (Html.text name) - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html_contents : ( - Battle.Struct.Statistics.Category -> - (List (Html.Html Struct.Event.Type)) - ) -get_html_contents cat = - let - (name, tooltip) = (Battle.Lang.English.get_statistic_category_help cat) - in - [ - (get_header_html cat name), - tooltip - ] diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm index a41afba..8d8c4ce 100644 --- a/src/shared/battle/Battle/View/Omnimods.elm +++ b/src/shared/battle/Battle/View/Omnimods.elm @@ -14,10 +14,10 @@ import Html.Events -- Battle ---------------------------------------------------------------------- import Battle.Struct.DamageType import Battle.Struct.Omnimods -import Battle.Struct.Statistics +import Battle.Struct.Attributes import Battle.View.DamageType -import Battle.View.Statistic +import Battle.View.Attribute -- Local Module ---------------------------------------------------------------- import Struct.Event @@ -70,16 +70,16 @@ get_html_with_modifier attack_multiplier omnimods = ), (Html.div [ - (Html.Attributes.class "omnimod-statistics-mods") + (Html.Attributes.class "omnimod-attribute-mods") ] (List.map (\(k, v) -> - (Battle.View.Statistic.get_signed_html - (Battle.Struct.Statistics.decode_category k) + (Battle.View.Attribute.get_signed_html + (Battle.Struct.Attributes.decode_category k) v ) ) - (Battle.Struct.Omnimods.get_statistics_mods omnimods) + (Battle.Struct.Omnimods.get_attribute_mods omnimods) ) ) ] @@ -122,16 +122,16 @@ get_html omnimods = ), (Html.div [ - (Html.Attributes.class "omnimod-statistics-mods") + (Html.Attributes.class "omnimod-attributes-mods") ] (List.map (\(k, v) -> - (Battle.View.Statistic.get_signed_html - (Battle.Struct.Statistics.decode_category k) + (Battle.View.Attribute.get_signed_html + (Battle.Struct.Attributes.decode_category k) v ) ) - (Battle.Struct.Omnimods.get_statistics_mods omnimods) + (Battle.Struct.Omnimods.get_attribute_mods omnimods) ) ) ] diff --git a/src/shared/battle/Battle/View/Statistic.elm b/src/shared/battle/Battle/View/Statistic.elm deleted file mode 100644 index 0ced0dc..0000000 --- a/src/shared/battle/Battle/View/Statistic.elm +++ /dev/null @@ -1,259 +0,0 @@ -module Battle.View.Statistic exposing - ( - get_html, - get_all_html, - get_all_but_gauges_html, - get_signed_html, - get_all_signed_html, - get_all_but_gauges_signed_html - ) - --- Elm ------------------------------------------------------------------------- -import Html -import Html.Attributes -import Html.Events - --- Battle ---------------------------------------------------------------------- -import Battle.Struct.Statistics - --- Local Module ---------------------------------------------------------------- -import Struct.Event -import Struct.HelpRequest - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : ( - Battle.Struct.Statistics.Category -> - Int -> - (Html.Html Struct.Event.Type) - ) -get_html statistic value = - (Html.div - [ - (Html.Events.onClick - (Struct.Event.RequestedHelp - (Struct.HelpRequest.Statistic statistic) - ) - ) - ] - [ - (Html.div - [ - (Html.Attributes.class "omnimod-icon"), - (Html.Attributes.class - ( - "omnimod-icon-" - ++ (Battle.Struct.Statistics.encode_category statistic) - ) - ) - ] - [ - ] - ), - (Html.div - [ - (Html.Attributes.class "omnimod-value") - ] - [ - (Html.text - ( - if (Battle.Struct.Statistics.is_percent statistic) - then ((String.fromInt value) ++ "%") - else (String.fromInt value) - ) - ) - ] - ) - ] - ) - -get_signed_html : ( - Battle.Struct.Statistics.Category -> - Int -> - (Html.Html Struct.Event.Type) - ) -get_signed_html statistic 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.Statistic statistic) - ) - ) - ] - [ - (Html.div - [ - (Html.Attributes.class "omnimod-icon"), - (Html.Attributes.class - ( - "omnimod-icon-" - ++ (Battle.Struct.Statistics.encode_category statistic) - ) - ) - ] - [ - ] - ), - (Html.div - [ - (Html.Attributes.class "omnimod-value") - ] - [ - (Html.text - ( - ( - if (value > 0) - then ("+" ++ (String.fromInt value)) - else (String.fromInt value) - ) - ++ - ( - if (Battle.Struct.Statistics.is_percent statistic) - then "%" - else "" - ) - ) - ) - ] - ) - ] - ) - -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) - ) - ] -- cgit v1.2.3-70-g09d2