summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-03-15 18:16:55 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-03-15 18:16:55 +0100 |
commit | 6678cfe464ed9ee595f4f3dd7398dec1416454c9 (patch) | |
tree | 2700668874e13a81ec7467dcf26a1d246caa23ff /src/battle/src/View | |
parent | 24efb898f526e0aa02a0e15b74436da8ba166cac (diff) |
[Broken] Starting a code refactoring...
Diffstat (limited to 'src/battle/src/View')
31 files changed, 251 insertions, 313 deletions
diff --git a/src/battle/src/View/Character.elm b/src/battle/src/View/Character.elm index 49de74b..e65f947 100644 --- a/src/battle/src/View/Character.elm +++ b/src/battle/src/View/Character.elm @@ -9,17 +9,20 @@ import Html import Html.Attributes import Html.Events --- Map ------------------------------------------------------------------ -import Constants.UI - +-- Shared ---------------------------------------------------------------------- import Util.Html -import Struct.Armor +-- Battle Characters ----------------------------------------------------------- +import BattleCharacters.Struct.Armor +import BattleCharacters.Struct.Portrait + +-- Local Module ---------------------------------------------------------------- +import Constants.UI + import Struct.Character import Struct.CharacterTurn import Struct.Event import Struct.Model -import Struct.Portrait import Struct.UI -------------------------------------------------------------------------------- @@ -116,7 +119,7 @@ get_icon_head_html char = ( "asset-character-icon-" ++ - (Struct.Portrait.get_icon_id + (BattleCharacters.Struct.Portrait.get_icon_id (Struct.Character.get_portrait char) ) ) @@ -163,7 +166,10 @@ get_portrait_body_html char = (Html.Attributes.class ( "asset-character-portrait-" - ++ (Struct.Portrait.get_id (Struct.Character.get_portrait char)) + ++ + (BattleCharacters.Struct.Portrait.get_id + (Struct.Character.get_portrait char) + ) ) ) ] @@ -180,14 +186,16 @@ get_portrait_armor_html char = ( "asset-armor-" ++ - (Struct.Armor.get_image_id (Struct.Character.get_armor char)) + (BattleCharacters.Struct.Armor.get_image_id + (Struct.Character.get_armor char) + ) ) ), (Html.Attributes.class ( "asset-armor-variation-" ++ - (Struct.Portrait.get_body_id + (BattleCharacters.Struct.Portrait.get_body_id (Struct.Character.get_portrait char) ) ) diff --git a/src/battle/src/View/Controlled.elm b/src/battle/src/View/Controlled.elm index cb71842..003ec34 100644 --- a/src/battle/src/View/Controlled.elm +++ b/src/battle/src/View/Controlled.elm @@ -5,13 +5,14 @@ import Html import Html.Attributes import Html.Events --- Struct.Map ------------------------------------------------------------------- +-- Shared ---------------------------------------------------------------------- +import Util.Html + +-- Local Module ---------------------------------------------------------------- import Struct.CharacterTurn import Struct.Event import Struct.Navigator -import Util.Html - import View.Controlled.CharacterCard import View.Controlled.ManualControls diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm index b9874f5..0ece1fa 100644 --- a/src/battle/src/View/Controlled/CharacterCard.elm +++ b/src/battle/src/View/Controlled/CharacterCard.elm @@ -12,19 +12,23 @@ import Html import Html.Attributes import Html.Events +-- Shared ---------------------------------------------------------------------- +import Util.Html + -- Battle ---------------------------------------------------------------------- -import Struct.Armor +import Battle.Struct.Omnimods +import Battle.Struct.Statistics + +-- Battle Characters ----------------------------------------------------------- +import BattleCharacters.Struct.Armor +import BattleCharacters.Struct.Weapon + +-- Local Module ---------------------------------------------------------------- import Struct.Character import Struct.CharacterTurn import Struct.Event import Struct.HelpRequest import Struct.Navigator -import Struct.Omnimods -import Struct.Statistics -import Struct.Weapon -import Struct.WeaponSet - -import Util.Html import View.Character import View.Gauge @@ -56,7 +60,7 @@ get_health_bar char = let current = (Struct.Character.get_sane_current_health char) max = - (Struct.Statistics.get_max_health + (Battle.Struct.Statistics.get_max_health (Struct.Character.get_statistics char) ) in @@ -68,10 +72,7 @@ get_health_bar char = [] ) -get_rank_status : ( - Struct.Character.Rank -> - (Html.Html Struct.Event.Type) - ) +get_rank_status : Struct.Character.Rank -> (Html.Html Struct.Event.Type) get_rank_status rank = (Html.div [ @@ -97,10 +98,7 @@ get_rank_status rank = ] ) -get_statuses : ( - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) +get_statuses : Struct.Character.Type -> (Html.Html Struct.Event.Type) get_statuses char = (Html.div [ @@ -123,7 +121,7 @@ get_active_movement_bar : ( get_active_movement_bar maybe_navigator char = let max = - (Struct.Statistics.get_movement_points + (Battle.Struct.Statistics.get_movement_points (Struct.Character.get_statistics char) ) current = @@ -149,7 +147,7 @@ get_inactive_movement_bar : ( get_inactive_movement_bar char = let max = - (Struct.Statistics.get_movement_points + (Battle.Struct.Statistics.get_movement_points (Struct.Character.get_statistics char) ) in @@ -158,7 +156,7 @@ get_inactive_movement_bar char = "MP: " ++ (String.fromInt - (Struct.Statistics.get_movement_points + (Battle.Struct.Statistics.get_movement_points (Struct.Character.get_statistics char) ) ) @@ -196,7 +194,7 @@ get_movement_bar char_turn char = get_weapon_field_header : ( Float -> - Struct.Weapon.Type -> + BattleCharacters.Struct.Weapon.Type -> (Html.Html Struct.Event.Type) ) get_weapon_field_header damage_multiplier weapon = @@ -209,7 +207,7 @@ get_weapon_field_header damage_multiplier weapon = [ ] [ - (Html.text (Struct.Weapon.get_name weapon)) + (Html.text (BattleCharacters.Struct.Weapon.get_name weapon)) ] ), (Html.div @@ -223,16 +221,29 @@ get_weapon_field_header damage_multiplier weapon = (String.fromInt (ceiling ( - (toFloat (Struct.Weapon.get_damage_sum weapon)) + (toFloat + (BattleCharacters.Struct.Weapon.get_damage_sum + weapon + ) + ) * damage_multiplier ) ) ) ++ " dmg @ [" ++ - (String.fromInt (Struct.Weapon.get_defense_range weapon)) + (String.fromInt + (BattleCharacters.Struct.Weapon.get_defense_range + weapon + ) + ) ++ ", " - ++ (String.fromInt (Struct.Weapon.get_attack_range weapon)) + ++ + (String.fromInt + (BattleCharacters.Struct.Weapon.get_attack_range + weapon + ) + ) ++ "]" ) ) @@ -243,9 +254,7 @@ 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 + let (category, value) = mod in (Html.div [ (Html.Attributes.class "info-card-mod") @@ -259,9 +268,7 @@ get_mod_html mod = get_multiplied_mod_html : Float -> (String, Int) -> (Html.Html Struct.Event.Type) get_multiplied_mod_html multiplier mod = - let - (category, value) = mod - in + let (category, value) = mod in (Html.div [ (Html.Attributes.class "character-card-mod") @@ -282,9 +289,9 @@ get_multiplied_mod_html multiplier mod = ) get_weapon_details : ( - Struct.Omnimods.Type -> + Battle.Struct.Omnimods.Type -> Float -> - Struct.Weapon.Type -> + BattleCharacters.Struct.Weapon.Type -> (Html.Html Struct.Event.Type) ) get_weapon_details omnimods damage_multiplier weapon = @@ -300,7 +307,7 @@ get_weapon_details omnimods damage_multiplier weapon = ] (List.map (get_multiplied_mod_html damage_multiplier) - (Struct.Omnimods.get_attack_mods omnimods) + (Battle.Struct.Omnimods.get_attack_mods omnimods) ) ) ] @@ -308,7 +315,7 @@ get_weapon_details omnimods damage_multiplier weapon = get_weapon_summary : ( Float -> - Struct.Weapon.Type -> + BattleCharacters.Struct.Weapon.Type -> (Html.Html Struct.Event.Type) ) get_weapon_summary damage_multiplier weapon = @@ -322,8 +329,8 @@ get_weapon_summary damage_multiplier weapon = ) get_armor_details : ( - Struct.Omnimods.Type -> - Struct.Armor.Type -> + Battle.Struct.Omnimods.Type -> + BattleCharacters.Struct.Armor.Type -> (Html.Html Struct.Event.Type) ) get_armor_details omnimods armor = @@ -337,7 +344,7 @@ get_armor_details omnimods armor = (Html.Attributes.class "character-card-armor-name") ] [ - (Html.text (Struct.Armor.get_name armor)) + (Html.text (BattleCharacters.Struct.Armor.get_name armor)) ] ), (Html.div @@ -346,13 +353,13 @@ get_armor_details omnimods armor = ] (List.map (get_mod_html) - (Struct.Omnimods.get_defense_mods omnimods) + (Battle.Struct.Omnimods.get_defense_mods omnimods) ) ) ] ) -stat_name : String -> (Html.Html Struct.Event.Type) +stat_name : String -> (Html.Html Struct.Event.Type) stat_name name = (Html.div [ @@ -374,20 +381,14 @@ stat_val val perc = ( (String.fromInt val) ++ - ( - if perc - then - "%" - else - "" - ) + (if perc then "%" else "") ) ) ] ) get_relevant_stats : ( - Struct.Statistics.Type -> + Battle.Struct.Statistics.Type -> (Html.Html Struct.Event.Type) ) get_relevant_stats stats = @@ -397,15 +398,15 @@ get_relevant_stats stats = ] [ (stat_name "Dodge"), - (stat_val (Struct.Statistics.get_dodges stats) True), + (stat_val (Battle.Struct.Statistics.get_dodges stats) True), (stat_name "Parry"), - (stat_val (Struct.Statistics.get_parries stats) True), + (stat_val (Battle.Struct.Statistics.get_parries stats) True), (stat_name "Accu."), - (stat_val (Struct.Statistics.get_accuracy stats) False), + (stat_val (Battle.Struct.Statistics.get_accuracy stats) False), (stat_name "2xHit"), - (stat_val (Struct.Statistics.get_double_hits stats) True), + (stat_val (Battle.Struct.Statistics.get_double_hits stats) True), (stat_name "Crit."), - (stat_val (Struct.Statistics.get_critical_hits stats) True) + (stat_val (Battle.Struct.Statistics.get_critical_hits stats) True) ] ) @@ -457,11 +458,22 @@ get_summary_html : ( ) get_summary_html char_turn player_ix char = let - weapon_set = (Struct.Character.get_weapons char) - main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set) + is_using_primary = (Struct.Character.get_is_using_primary char) + active_weapon = + ( + if (is_using_primary) + then (Struct.Character.get_primary_weapon char) + else (Struct.Character.get_secondary_weapon char) + ) + inactive_weapon = + ( + if (is_using_primary) + then (Struct.Character.get_secondary_weapon char) + else (Struct.Character.get_primary_weapon char) + ) char_statistics = (Struct.Character.get_statistics char) - damage_modifier = (Struct.Statistics.get_damage_modifier char_statistics) - secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set) + damage_modifier = + (Battle.Struct.Statistics.get_damage_modifier char_statistics) omnimods = (Struct.Character.get_current_omnimods char) in (Html.div @@ -489,10 +501,10 @@ get_summary_html char_turn player_ix char = (get_statuses char) ] ), - (get_weapon_details omnimods damage_modifier main_weapon), + (get_weapon_details omnimods damage_modifier active_weapon), (get_armor_details omnimods (Struct.Character.get_armor char)), (get_relevant_stats char_statistics), - (get_weapon_summary damage_modifier secondary_weapon) + (get_weapon_summary damage_modifier inactive_weapon) ] ) @@ -503,13 +515,24 @@ get_full_html : ( ) get_full_html player_ix char = let - weapon_set = (Struct.Character.get_weapons char) - main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set) + is_using_primary = (Struct.Character.get_is_using_primary char) + active_weapon = + ( + if (is_using_primary) + then (Struct.Character.get_primary_weapon char) + else (Struct.Character.get_secondary_weapon char) + ) + inactive_weapon = + ( + if (is_using_primary) + then (Struct.Character.get_secondary_weapon char) + else (Struct.Character.get_primary_weapon char) + ) char_statistics = (Struct.Character.get_statistics char) - damage_modifier = (Struct.Statistics.get_damage_modifier char_statistics) - secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set) - armor = (Struct.Character.get_armor char) + damage_modifier = + (Battle.Struct.Statistics.get_damage_modifier char_statistics) omnimods = (Struct.Character.get_current_omnimods char) + armor = (Struct.Character.get_armor char) in (Html.div [ @@ -537,9 +560,9 @@ get_full_html player_ix char = (get_statuses char) ] ), - (get_weapon_details omnimods damage_modifier main_weapon), + (get_weapon_details omnimods damage_modifier active_weapon), (get_armor_details omnimods armor), (get_relevant_stats char_statistics), - (get_weapon_summary damage_modifier secondary_weapon) + (get_weapon_summary damage_modifier inactive_weapon) ] ) diff --git a/src/battle/src/View/Controlled/ManualControls.elm b/src/battle/src/View/Controlled/ManualControls.elm index 7dd88e7..d65bd1a 100644 --- a/src/battle/src/View/Controlled/ManualControls.elm +++ b/src/battle/src/View/Controlled/ManualControls.elm @@ -5,15 +5,17 @@ import Html import Html.Attributes import Html.Events --- Map ------------------------------------------------------------------- -import Struct.Direction +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Direction + +-- Local Module ---------------------------------------------------------------- import Struct.Event -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- direction_button : ( - Struct.Direction.Type -> + BattleMap.Struct.Direction.Type -> String -> (Html.Html Struct.Event.Type) ) @@ -51,10 +53,10 @@ get_html = (Html.Attributes.class "manual-controls") ] [ - (direction_button Struct.Direction.Left "left"), - (direction_button Struct.Direction.Down "down"), - (direction_button Struct.Direction.Up "up"), - (direction_button Struct.Direction.Right "right"), + (direction_button BattleMap.Struct.Direction.Left "left"), + (direction_button BattleMap.Struct.Direction.Down "down"), + (direction_button BattleMap.Struct.Direction.Up "up"), + (direction_button BattleMap.Struct.Direction.Right "right"), (go_button) ] ) diff --git a/src/battle/src/View/Controlled/Targets.elm b/src/battle/src/View/Controlled/Targets.elm index c92d1d4..f057cba 100644 --- a/src/battle/src/View/Controlled/Targets.elm +++ b/src/battle/src/View/Controlled/Targets.elm @@ -6,11 +6,13 @@ import Dict import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Battle ---------------------------------------------------------------------- +import Battle.Struct.Statistics + +-- Local Module ---------------------------------------------------------------- import Struct.Character import Struct.Event import Struct.Model -import Struct.Statistics -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -34,7 +36,7 @@ get_target_info_html model char_ref = ++ "): " ++ (String.fromInt - (Struct.Statistics.get_movement_points + (Battle.Struct.Statistics.get_movement_points (Struct.Character.get_statistics char) ) ) @@ -48,7 +50,7 @@ get_target_info_html model char_ref = ++ "/" ++ (String.fromInt - (Struct.Statistics.get_max_health + (Battle.Struct.Statistics.get_max_health (Struct.Character.get_statistics char) ) ) diff --git a/src/battle/src/View/Gauge.elm b/src/battle/src/View/Gauge.elm index d7ea8b1..50dbea3 100644 --- a/src/battle/src/View/Gauge.elm +++ b/src/battle/src/View/Gauge.elm @@ -4,7 +4,7 @@ module View.Gauge exposing (get_html) import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event -------------------------------------------------------------------------------- diff --git a/src/battle/src/View/MainMenu.elm b/src/battle/src/View/MainMenu.elm index e436555..a40b2a3 100644 --- a/src/battle/src/View/MainMenu.elm +++ b/src/battle/src/View/MainMenu.elm @@ -5,7 +5,7 @@ import Html import Html.Attributes import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.UI diff --git a/src/battle/src/View/Map.elm b/src/battle/src/View/Map.elm index 6ae3e01..1de8472 100644 --- a/src/battle/src/View/Map.elm +++ b/src/battle/src/View/Map.elm @@ -9,26 +9,31 @@ import Html.Lazy import List --- Map ------------------------------------------------------------------- +-- Shared ---------------------------------------------------------------------- +import Util.Html + +-- Battle ---------------------------------------------------------------------- +import View.BattleMap.Tile + +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Map + +-- Local Module ---------------------------------------------------------------- import Constants.UI -import Struct.Map import Struct.Character import Struct.Event import Struct.Model import Struct.Navigator import Struct.UI -import Util.Html - import View.Map.Character import View.Map.Navigator -import View.Map.Tile -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_tiles_html : Struct.Map.Type -> (Html.Html Struct.Event.Type) +get_tiles_html : BattleMap.Struct.Map.Type -> (Html.Html Struct.Event.Type) get_tiles_html map = (Html.div [ @@ -38,7 +43,7 @@ get_tiles_html map = ( (String.fromInt ( - (Struct.Map.get_width map) + (BattleMap.Struct.Map.get_width map) * Constants.UI.tile_size ) ) @@ -50,7 +55,7 @@ get_tiles_html map = ( (String.fromInt ( - (Struct.Map.get_height map) + (BattleMap.Struct.Map.get_height map) * Constants.UI.tile_size ) ) @@ -59,8 +64,8 @@ get_tiles_html map = ) ] (List.map - (View.Map.Tile.get_html) - (Array.toList (Struct.Map.get_tiles map)) + (View.BattleMap.Tile.get_html False) + (Array.toList (BattleMap.Struct.Map.get_tiles map)) ) ) diff --git a/src/battle/src/View/Map/Character.elm b/src/battle/src/View/Map/Character.elm index af41050..6031cff 100644 --- a/src/battle/src/View/Map/Character.elm +++ b/src/battle/src/View/Map/Character.elm @@ -5,16 +5,19 @@ import Html import Html.Attributes import Html.Events --- Battle ---------------------------------------------------------------------- -import Constants.UI - +-- Shared ---------------------------------------------------------------------- import Util.Html +-- Battle Characters ----------------------------------------------------------- +import BattleCharacters.Struct.Portrait + +-- Local Module ---------------------------------------------------------------- +import Constants.UI + import Struct.Character import Struct.CharacterTurn import Struct.Event import Struct.Model -import Struct.Portrait import Struct.TurnResult import Struct.TurnResultAnimator import Struct.UI @@ -147,7 +150,7 @@ get_head_html char = (Html.Attributes.class "character-icon-head"), (Html.Attributes.class ("asset-character-icon-" ++ - (Struct.Portrait.get_icon_id + (BattleCharacters.Struct.Portrait.get_icon_id (Struct.Character.get_portrait char) ) ) diff --git a/src/battle/src/View/Map/Navigator.elm b/src/battle/src/View/Map/Navigator.elm index 0cfce61..9727046 100644 --- a/src/battle/src/View/Map/Navigator.elm +++ b/src/battle/src/View/Map/Navigator.elm @@ -7,12 +7,14 @@ import Html.Events import List --- Map ------------------------------------------------------------------- +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Direction +import BattleMap.Struct.Location + +-- Local Module ---------------------------------------------------------------- import Constants.UI -import Struct.Direction import Struct.Event -import Struct.Location import Struct.Marker import Struct.Navigator @@ -21,11 +23,11 @@ import Struct.Navigator -------------------------------------------------------------------------------- marker_get_html : ( Bool -> - (Struct.Location.Ref, Struct.Marker.Type) -> + (BattleMap.Struct.Location.Ref, Struct.Marker.Type) -> (Html.Html Struct.Event.Type) ) marker_get_html is_interactive (loc_ref, marker) = - let loc = (Struct.Location.from_ref loc_ref) in + let loc = (BattleMap.Struct.Location.from_ref loc_ref) in (Html.div ( [ @@ -94,21 +96,21 @@ marker_get_html is_interactive (loc_ref, marker) = path_node_get_html : ( Bool -> - Struct.Direction.Type -> + BattleMap.Struct.Direction.Type -> ( - Struct.Location.Type, - Struct.Direction.Type, + BattleMap.Struct.Location.Type, + BattleMap.Struct.Direction.Type, (List (Html.Html Struct.Event.Type)) ) -> ( - Struct.Location.Type, - Struct.Direction.Type, + BattleMap.Struct.Location.Type, + BattleMap.Struct.Direction.Type, (List (Html.Html Struct.Event.Type)) ) ) path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) = ( - (Struct.Location.neighbor next_dir curr_loc), + (BattleMap.Struct.Location.neighbor next_dir curr_loc), next_dir, ( (Html.div @@ -128,14 +130,14 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) = ( "path-icon-" ++ - (Struct.Direction.to_string curr_dir) + (BattleMap.Struct.Direction.to_string curr_dir) ++ - (Struct.Direction.to_string next_dir) + (BattleMap.Struct.Direction.to_string next_dir) ) ), (Html.Events.onClick (Struct.Event.CharacterOrTileSelected - (Struct.Location.get_ref curr_loc) + (BattleMap.Struct.Location.get_ref curr_loc) ) ), (Html.Attributes.style @@ -168,8 +170,8 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) = ) mark_the_spot : ( - Struct.Location.Type -> - Struct.Direction.Type -> + BattleMap.Struct.Location.Type -> + BattleMap.Struct.Direction.Type -> (Html.Html Struct.Event.Type) ) mark_the_spot loc origin_dir = @@ -182,11 +184,13 @@ mark_the_spot loc origin_dir = ( "path-icon-mark" ++ - (Struct.Direction.to_string origin_dir) + (BattleMap.Struct.Direction.to_string origin_dir) ) ), (Html.Events.onClick - (Struct.Event.CharacterOrTileSelected (Struct.Location.get_ref loc)) + (Struct.Event.CharacterOrTileSelected + (BattleMap.Struct.Location.get_ref loc) + ) ), (Html.Attributes.style "top" @@ -220,7 +224,11 @@ get_html nav_summary is_interactive = (final_loc, final_dir, path_node_htmls) = (List.foldr (path_node_get_html nav_summary.locked_path) - (nav_summary.starting_location, Struct.Direction.None, []) + ( + nav_summary.starting_location, + BattleMap.Struct.Direction.None, + [] + ) nav_summary.path ) in diff --git a/src/battle/src/View/Map/Tile.elm b/src/battle/src/View/Map/Tile.elm deleted file mode 100644 index abadea1..0000000 --- a/src/battle/src/View/Map/Tile.elm +++ /dev/null @@ -1,130 +0,0 @@ -module View.Map.Tile exposing (get_html, get_content_html) - --- Elm ------------------------------------------------------------------------- -import Html -import Html.Attributes -import Html.Events - --- Map ------------------------------------------------------------------- -import Constants.UI -import Constants.IO - -import Struct.Event -import Struct.Location -import Struct.TileInstance - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_layer_html : ( - Int -> - Struct.TileInstance.Border -> - (Html.Html Struct.Event.Type) - ) -get_layer_html index border = - (Html.div - [ - (Html.Attributes.class ("tile-icon-f-" ++ (String.fromInt index))), - (Html.Attributes.style - "background-image" - ( - "url(" - ++ Constants.IO.tile_assets_url - ++ (Struct.TileInstance.get_border_class_id border) - ++ "-f-" - ++ (Struct.TileInstance.get_border_variant_id border) - ++ ".svg)" - ) - ) - ] - [] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_content_html : ( - Struct.TileInstance.Type -> - (List (Html.Html Struct.Event.Type)) - ) -get_content_html tile = - ( - (Html.div - [ - (Html.Attributes.class "tile-icon-bg"), - (Html.Attributes.style - "background-image" - ( - "url(" - ++ Constants.IO.tile_assets_url - ++ (Struct.TileInstance.get_class_id tile) - ++ "-bg.svg)" - ) - ) - ] - [] - ) - :: - ( - (Html.div - [ - (Html.Attributes.class "tile-icon-dt"), - (Html.Attributes.style - "background-image" - ( - "url(" - ++ Constants.IO.tile_assets_url - ++ (Struct.TileInstance.get_class_id tile) - ++ "-v-" - ++ (Struct.TileInstance.get_variant_id tile) - ++ ".svg)" - ) - ) - ] - [] - ) - :: - (List.indexedMap - (get_layer_html) - (Struct.TileInstance.get_borders tile) - ) - ) - ) - -get_html : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) -get_html tile = - let tile_loc = (Struct.TileInstance.get_location tile) in - (Html.div - [ - (Html.Attributes.class "tile-icon"), - (Html.Attributes.class "tiled"), - (Html.Attributes.class - ( - "tile-variant-" - ++ - (String.fromInt - (Struct.TileInstance.get_local_variant_ix tile) - ) - ) - ), - (Html.Attributes.class "clickable"), - (Html.Events.onClick - (Struct.Event.TileSelected (Struct.Location.get_ref tile_loc)) - ), - (Html.Attributes.style - "top" - ( - (String.fromInt (tile_loc.y * Constants.UI.tile_size)) - ++ "px" - ) - ), - (Html.Attributes.style - "left" - ( - (String.fromInt (tile_loc.x * Constants.UI.tile_size)) - ++ "px" - ) - ) - ] - (get_content_html tile) - ) diff --git a/src/battle/src/View/MessageBoard.elm b/src/battle/src/View/MessageBoard.elm index 736f938..082d2c9 100644 --- a/src/battle/src/View/MessageBoard.elm +++ b/src/battle/src/View/MessageBoard.elm @@ -3,7 +3,7 @@ module View.MessageBoard exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html --- Struct.Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.Model diff --git a/src/battle/src/View/MessageBoard/Animator.elm b/src/battle/src/View/MessageBoard/Animator.elm index 49bb83a..c653e5e 100644 --- a/src/battle/src/View/MessageBoard/Animator.elm +++ b/src/battle/src/View/MessageBoard/Animator.elm @@ -3,14 +3,15 @@ module View.MessageBoard.Animator exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html --- Map ------------------------------------------------------------------- +-- Shared ---------------------------------------------------------------------- +import Util.Html + +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.Model import Struct.TurnResult import Struct.TurnResultAnimator -import Util.Html - import View.MessageBoard.Animator.Attack -------------------------------------------------------------------------------- diff --git a/src/battle/src/View/MessageBoard/Animator/Attack.elm b/src/battle/src/View/MessageBoard/Animator/Attack.elm index b715ac5..93a5e8a 100644 --- a/src/battle/src/View/MessageBoard/Animator/Attack.elm +++ b/src/battle/src/View/MessageBoard/Animator/Attack.elm @@ -6,13 +6,14 @@ import Array import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Attack import Struct.Character import Struct.Event import Struct.Model import View.Controlled.CharacterCard + -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- diff --git a/src/battle/src/View/MessageBoard/Error.elm b/src/battle/src/View/MessageBoard/Error.elm index c03467a..72de518 100644 --- a/src/battle/src/View/MessageBoard/Error.elm +++ b/src/battle/src/View/MessageBoard/Error.elm @@ -4,7 +4,7 @@ module View.MessageBoard.Error exposing (get_html) import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Error import Struct.Event import Struct.Model diff --git a/src/battle/src/View/MessageBoard/Help.elm b/src/battle/src/View/MessageBoard/Help.elm index a1d1af7..6b8480f 100644 --- a/src/battle/src/View/MessageBoard/Help.elm +++ b/src/battle/src/View/MessageBoard/Help.elm @@ -4,7 +4,7 @@ module View.MessageBoard.Help exposing (get_html) import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.HelpRequest import Struct.Model diff --git a/src/battle/src/View/MessageBoard/Help/Guide.elm b/src/battle/src/View/MessageBoard/Help/Guide.elm index 38c2a9a..deb5190 100644 --- a/src/battle/src/View/MessageBoard/Help/Guide.elm +++ b/src/battle/src/View/MessageBoard/Help/Guide.elm @@ -4,7 +4,7 @@ module View.MessageBoard.Help.Guide exposing (get_html_contents) import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.CharacterTurn import Struct.Event import Struct.Model diff --git a/src/battle/src/View/MessageBoard/Help/Rank.elm b/src/battle/src/View/MessageBoard/Help/Rank.elm index 9e9a858..a4634a4 100644 --- a/src/battle/src/View/MessageBoard/Help/Rank.elm +++ b/src/battle/src/View/MessageBoard/Help/Rank.elm @@ -4,7 +4,7 @@ module View.MessageBoard.Help.Rank exposing (get_html_contents) import Html import Html.Attributes --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Character import Struct.Event diff --git a/src/battle/src/View/SubMenu.elm b/src/battle/src/View/SubMenu.elm index a010019..60a1c7d 100644 --- a/src/battle/src/View/SubMenu.elm +++ b/src/battle/src/View/SubMenu.elm @@ -7,14 +7,15 @@ import Html import Html.Attributes import Html.Lazy --- Map ------------------------------------------------------------------- +-- Shared ---------------------------------------------------------------------- +import Util.Html + +-- Local Module ---------------------------------------------------------------- import Struct.CharacterTurn import Struct.Event import Struct.Model import Struct.UI -import Util.Html - import View.Controlled.CharacterCard import View.SubMenu.Characters diff --git a/src/battle/src/View/SubMenu/Characters.elm b/src/battle/src/View/SubMenu/Characters.elm index e433ab0..411e5e0 100644 --- a/src/battle/src/View/SubMenu/Characters.elm +++ b/src/battle/src/View/SubMenu/Characters.elm @@ -1,13 +1,13 @@ module View.SubMenu.Characters exposing (get_html) -- Elm ------------------------------------------------------------------------- -import Array +import Array import Html import Html.Attributes import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Character import Struct.Event diff --git a/src/battle/src/View/SubMenu/Settings.elm b/src/battle/src/View/SubMenu/Settings.elm index 0becac1..d214c7b 100644 --- a/src/battle/src/View/SubMenu/Settings.elm +++ b/src/battle/src/View/SubMenu/Settings.elm @@ -5,7 +5,7 @@ import Html import Html.Attributes import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.Model diff --git a/src/battle/src/View/SubMenu/Status.elm b/src/battle/src/View/SubMenu/Status.elm index afb9f09..b5d69f7 100644 --- a/src/battle/src/View/SubMenu/Status.elm +++ b/src/battle/src/View/SubMenu/Status.elm @@ -7,9 +7,11 @@ import Html import Html.Attributes import Html.Lazy --- Struct.Map ------------------------------------------------------------------- +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Location + +-- Local Module ---------------------------------------------------------------- import Struct.Event -import Struct.Location import Struct.Model import Struct.UI @@ -34,7 +36,7 @@ get_html model = (Just (Struct.UI.SelectedLocation loc)) -> (View.SubMenu.Status.TileInfo.get_html model - (Struct.Location.from_ref loc) + (BattleMap.Struct.Location.from_ref loc) ) (Just (Struct.UI.SelectedCharacter target_char)) -> diff --git a/src/battle/src/View/SubMenu/Status/CharacterInfo.elm b/src/battle/src/View/SubMenu/Status/CharacterInfo.elm index 094b8d0..a8891e4 100644 --- a/src/battle/src/View/SubMenu/Status/CharacterInfo.elm +++ b/src/battle/src/View/SubMenu/Status/CharacterInfo.elm @@ -4,7 +4,7 @@ module View.SubMenu.Status.CharacterInfo exposing (get_html) import Html import Html.Attributes --- Struct.Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Character import Struct.Event diff --git a/src/battle/src/View/SubMenu/Status/TileInfo.elm b/src/battle/src/View/SubMenu/Status/TileInfo.elm index 44f7293..f8b2b82 100644 --- a/src/battle/src/View/SubMenu/Status/TileInfo.elm +++ b/src/battle/src/View/SubMenu/Status/TileInfo.elm @@ -6,25 +6,30 @@ import Dict import Html import Html.Attributes +-- Shared ---------------------------------------------------------------------- +import Util.Html + -- Battle ---------------------------------------------------------------------- +import Battle.Struct.Omnimods + +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Location +import BattleMap.Struct.Map +import BattleMap.Struct.Tile +import BattleMap.Struct.TileInstance + +import BattleMap.View.Map.Tile + +-- Local Module ---------------------------------------------------------------- import Constants.Movement -import Struct.Map import Struct.Event -import Struct.Location -import Struct.Omnimods import Struct.Model -import Struct.Tile -import Struct.TileInstance - -import Util.Html - -import View.Map.Tile -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_icon : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)) +get_icon : (BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)) get_icon tile = (Html.div [ @@ -35,21 +40,26 @@ get_icon tile = "tile-variant-" ++ (String.fromInt - (Struct.TileInstance.get_local_variant_ix tile) + (BattleMap.Struct.TileInstance.get_local_variant_ix tile) ) ) ) ] - (View.Map.Tile.get_content_html tile) + (BattleMap.View.Map.Tile.get_content_html tile) ) get_name : ( Struct.Model.Type -> - Struct.TileInstance.Type -> + BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) ) get_name model tile_inst = - case (Dict.get (Struct.TileInstance.get_class_id tile_inst) model.tiles) of + case + (Dict.get + (BattleMap.Struct.TileInstance.get_class_id tile_inst) + model.tiles + ) + of Nothing -> (Util.Html.nothing) (Just tile) -> (Html.div @@ -59,14 +69,14 @@ get_name model tile_inst = (Html.Attributes.class "tile-card-name") ] [ - (Html.text (Struct.Tile.get_name tile)) + (Html.text (BattleMap.Struct.Tile.get_name tile)) ] ) -get_cost : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) +get_cost : BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) get_cost tile_inst = let - cost = (Struct.TileInstance.get_cost tile_inst) + cost = (BattleMap.Struct.TileInstance.get_cost tile_inst) text = if (cost > Constants.Movement.max_points) then @@ -84,10 +94,10 @@ get_cost tile_inst = ] ) -get_location : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) +get_location : BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type) get_location tile_inst = let - tile_location = (Struct.TileInstance.get_location tile_inst) + tile_location = (BattleMap.Struct.TileInstance.get_location tile_inst) in (Html.div [ @@ -132,7 +142,7 @@ get_omnimods_listing mod_list = (List.map (get_mod_html) mod_list) ) -get_omnimods : Struct.Omnimods.Type -> (Html.Html Struct.Event.Type) +get_omnimods : Battle.Struct.Omnimods.Type -> (Html.Html Struct.Event.Type) get_omnimods omnimods = (Html.div [ @@ -140,13 +150,21 @@ get_omnimods omnimods = ] [ (Html.text "Attribute Modifiers"), - (get_omnimods_listing (Struct.Omnimods.get_attributes_mods omnimods)), + (get_omnimods_listing + (Battle.Struct.Omnimods.get_attributes_mods omnimods) + ), (Html.text "Statistics Modifiers"), - (get_omnimods_listing (Struct.Omnimods.get_statistics_mods omnimods)), + (get_omnimods_listing + (Battle.Struct.Omnimods.get_statistics_mods omnimods) + ), (Html.text "Attack Modifiers"), - (get_omnimods_listing (Struct.Omnimods.get_attack_mods omnimods)), + (get_omnimods_listing + (Battle.Struct.Omnimods.get_attack_mods omnimods) + ), (Html.text "Defense Modifiers"), - (get_omnimods_listing (Struct.Omnimods.get_defense_mods omnimods)) + (get_omnimods_listing + (Battle.Struct.Omnimods.get_defense_mods omnimods) + ) ] ) -------------------------------------------------------------------------------- @@ -154,11 +172,11 @@ get_omnimods omnimods = -------------------------------------------------------------------------------- get_html : ( Struct.Model.Type -> - Struct.Location.Type -> + BattleMap.Struct.Location.Type -> (Html.Html Struct.Event.Type) ) get_html model loc = - case (Struct.Map.try_getting_tile_at loc model.map) of + case (BattleMap.Struct.Map.try_getting_tile_at loc model.map) of (Just tile) -> (Html.div [ diff --git a/src/battle/src/View/SubMenu/Timeline.elm b/src/battle/src/View/SubMenu/Timeline.elm index a0978b5..50c1ba3 100644 --- a/src/battle/src/View/SubMenu/Timeline.elm +++ b/src/battle/src/View/SubMenu/Timeline.elm @@ -5,10 +5,9 @@ import Array import Html import Html.Attributes ---import Html.Events import Html.Lazy --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Character import Struct.Event import Struct.TurnResult diff --git a/src/battle/src/View/SubMenu/Timeline/Attack.elm b/src/battle/src/View/SubMenu/Timeline/Attack.elm index 3eb3a04..9bd7e57 100644 --- a/src/battle/src/View/SubMenu/Timeline/Attack.elm +++ b/src/battle/src/View/SubMenu/Timeline/Attack.elm @@ -5,9 +5,8 @@ import Array import Html import Html.Attributes ---import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Attack import Struct.Event import Struct.TurnResult diff --git a/src/battle/src/View/SubMenu/Timeline/Movement.elm b/src/battle/src/View/SubMenu/Timeline/Movement.elm index 028453c..7235026 100644 --- a/src/battle/src/View/SubMenu/Timeline/Movement.elm +++ b/src/battle/src/View/SubMenu/Timeline/Movement.elm @@ -5,9 +5,8 @@ import Array import Html import Html.Attributes ---import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.TurnResult import Struct.Character diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm b/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm index b2afd6e..7fac611 100644 --- a/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm +++ b/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm @@ -3,9 +3,8 @@ module View.SubMenu.Timeline.PlayerDefeat exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html import Html.Attributes ---import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.TurnResult diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm b/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm index 1c4b829..6de8d1f 100644 --- a/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm +++ b/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm @@ -3,9 +3,8 @@ module View.SubMenu.Timeline.PlayerTurnStart exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html import Html.Attributes ---import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.TurnResult diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm b/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm index 9f166e4..396d601 100644 --- a/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm +++ b/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm @@ -3,9 +3,8 @@ module View.SubMenu.Timeline.PlayerVictory exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html import Html.Attributes ---import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.TurnResult diff --git a/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm index 2e874b0..025c2b9 100644 --- a/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm +++ b/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm @@ -5,9 +5,8 @@ import Array import Html import Html.Attributes ---import Html.Events --- Map ------------------------------------------------------------------- +-- Local Module ---------------------------------------------------------------- import Struct.Event import Struct.TurnResult import Struct.Character |