From c8d7b3e116e4f8ff1a7b88a3fa85f7263c83e346 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 24 Sep 2018 14:59:32 +0200 Subject: Slowly hacking my way to something that compiles... --- src/roster-editor/src/Constants/IO.elm.m4 | 2 +- src/roster-editor/src/ElmModule/Init.elm | 4 +- src/roster-editor/src/ElmModule/Update.elm | 62 +---- src/roster-editor/src/Struct/Character.elm | 196 ++------------ src/roster-editor/src/Struct/Event.elm | 1 - src/roster-editor/src/Struct/Glyph.elm | 30 +++ src/roster-editor/src/Struct/GlyphBoard.elm | 38 +++ src/roster-editor/src/Struct/HelpRequest.elm | 4 +- src/roster-editor/src/Struct/Model.elm | 1 - src/roster-editor/src/Struct/Omnimods.elm | 10 + src/roster-editor/src/Update/HandleServerReply.elm | 4 - src/roster-editor/src/View/ArmorSelection.elm | 25 ++ src/roster-editor/src/View/Character.elm | 14 +- src/roster-editor/src/View/CharacterCard.elm | 67 +---- src/roster-editor/src/View/CharacterSelection.elm | 25 ++ src/roster-editor/src/View/GlyphManagement.elm | 25 ++ src/roster-editor/src/View/MessageBoard.elm | 10 +- .../src/View/MessageBoard/Animator.elm | 57 ---- .../src/View/MessageBoard/Animator/Attack.elm | 297 --------------------- .../src/View/MessageBoard/Help/Guide.elm | 72 +---- src/roster-editor/src/View/PortraitSelection.elm | 25 ++ src/roster-editor/src/View/WeaponSelection.elm | 25 ++ 22 files changed, 242 insertions(+), 752 deletions(-) create mode 100644 src/roster-editor/src/Struct/Glyph.elm create mode 100644 src/roster-editor/src/Struct/GlyphBoard.elm create mode 100644 src/roster-editor/src/View/ArmorSelection.elm create mode 100644 src/roster-editor/src/View/CharacterSelection.elm create mode 100644 src/roster-editor/src/View/GlyphManagement.elm delete mode 100644 src/roster-editor/src/View/MessageBoard/Animator.elm delete mode 100644 src/roster-editor/src/View/MessageBoard/Animator/Attack.elm create mode 100644 src/roster-editor/src/View/PortraitSelection.elm create mode 100644 src/roster-editor/src/View/WeaponSelection.elm (limited to 'src/roster-editor') diff --git a/src/roster-editor/src/Constants/IO.elm.m4 b/src/roster-editor/src/Constants/IO.elm.m4 index c78c717..ae19a01 100644 --- a/src/roster-editor/src/Constants/IO.elm.m4 +++ b/src/roster-editor/src/Constants/IO.elm.m4 @@ -7,4 +7,4 @@ roster_handler_url : String roster_handler_url = (base_url ++ "/handler/roster") roster_loading_handler : String -roster_loading_handler = (map_handler_url ++ "/rst_load") +roster_loading_handler = (roster_handler_url ++ "/rst_load") diff --git a/src/roster-editor/src/ElmModule/Init.elm b/src/roster-editor/src/ElmModule/Init.elm index 4fccd82..51a9b1b 100644 --- a/src/roster-editor/src/ElmModule/Init.elm +++ b/src/roster-editor/src/ElmModule/Init.elm @@ -3,7 +3,7 @@ module ElmModule.Init exposing (init) -- Elm ------------------------------------------------------------------------- -- Map ------------------------------------------------------------------- -import Comm.LoadBattle +import Comm.LoadRoster import Struct.Event import Struct.Flags @@ -21,7 +21,7 @@ init flags = let model = (Struct.Model.new flags) in ( model, - (case (Comm.LoadBattle.try model) of + (case (Comm.LoadRoster.try model) of (Just cmd) -> cmd Nothing -> Cmd.none ) diff --git a/src/roster-editor/src/ElmModule/Update.elm b/src/roster-editor/src/ElmModule/Update.elm index f9d7d38..08aa207 100644 --- a/src/roster-editor/src/ElmModule/Update.elm +++ b/src/roster-editor/src/ElmModule/Update.elm @@ -2,30 +2,15 @@ module ElmModule.Update exposing (update) -- Elm ------------------------------------------------------------------------- --- Battle ---------------------------------------------------------------------- +-- Roster Editor --------------------------------------------------------------- import Struct.Event import Struct.Model -import Update.AbortTurn -import Update.AttackWithoutMoving -import Update.ChangeScale -import Update.DisplayCharacterInfo -import Update.EndTurn import Update.GoToMainMenu -import Update.HandleAnimationEnded import Update.HandleServerReply -import Update.LookForCharacter -import Update.RequestDirection import Update.SelectCharacter -import Update.SelectCharacterOrTile import Update.SelectTab -import Update.SelectTile -import Update.SendLoadBattleRequest import Update.SetRequestedHelp -import Update.SwitchTeam -import Update.SwitchWeapon -import Update.TestAnimation -import Update.UndoAction -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -53,60 +38,15 @@ update event model = Cmd.none ) - Struct.Event.AttackWithoutMovingRequest -> - (Update.AttackWithoutMoving.apply_to new_model) - - Struct.Event.AnimationEnded -> - (Update.HandleAnimationEnded.apply_to model) - - (Struct.Event.DirectionRequested d) -> - (Update.RequestDirection.apply_to new_model d) - - (Struct.Event.TileSelected loc) -> - (Update.SelectTile.apply_to new_model loc) - - (Struct.Event.CharacterOrTileSelected loc) -> - (Update.SelectCharacterOrTile.apply_to new_model loc) - (Struct.Event.CharacterSelected char_id) -> (Update.SelectCharacter.apply_to new_model char_id) - (Struct.Event.CharacterInfoRequested char_id) -> - (Update.DisplayCharacterInfo.apply_to new_model char_id) - - (Struct.Event.LookingForCharacter char_id) -> - (Update.LookForCharacter.apply_to new_model char_id) - - Struct.Event.TurnEnded -> - (Update.EndTurn.apply_to new_model) - - (Struct.Event.ScaleChangeRequested mod) -> - (Update.ChangeScale.apply_to new_model mod) - (Struct.Event.TabSelected tab) -> (Update.SelectTab.apply_to new_model tab) - Struct.Event.DebugTeamSwitchRequest -> - (Update.SwitchTeam.apply_to new_model) - - Struct.Event.DebugTestAnimation -> - (Update.TestAnimation.apply_to new_model) - - (Struct.Event.DebugLoadBattleRequest) -> - (Update.SendLoadBattleRequest.apply_to new_model) - (Struct.Event.ServerReplied result) -> (Update.HandleServerReply.apply_to model result) - Struct.Event.WeaponSwitchRequest -> - (Update.SwitchWeapon.apply_to new_model) - - Struct.Event.AbortTurnRequest -> - (Update.AbortTurn.apply_to new_model) - - Struct.Event.UndoActionRequest -> - (Update.UndoAction.apply_to new_model) - (Struct.Event.RequestedHelp help_request) -> (Update.SetRequestedHelp.apply_to new_model help_request) diff --git a/src/roster-editor/src/Struct/Character.elm b/src/roster-editor/src/Struct/Character.elm index b837962..d20b22f 100644 --- a/src/roster-editor/src/Struct/Character.elm +++ b/src/roster-editor/src/Struct/Character.elm @@ -1,43 +1,31 @@ module Struct.Character exposing ( Type, - Rank(..), get_index, - get_player_ix, get_name, - get_rank, - get_icon_id, get_portrait_id, get_armor, - get_armor_variation, - get_current_health, get_current_omnimods, - get_sane_current_health, - set_current_health, - get_location, - set_location, get_attributes, get_statistics, - is_enabled, - is_defeated, - is_alive, - set_enabled, - set_defeated, get_weapons, set_weapons, - decoder, - refresh_omnimods, - fill_missing_equipment_and_omnimods +-- get_glyph_board, +-- get_glyphes, + decoder ) -- Elm ------------------------------------------------------------------------- +import Array + import Json.Decode import Json.Decode.Pipeline --- Map ------------------------------------------------------------------- +-- Roster Editor --------------------------------------------------------------- import Struct.Armor import Struct.Attributes -import Struct.Location +import Struct.Glyph +import Struct.GlyphBoard import Struct.Omnimods import Struct.Statistics import Struct.Weapon @@ -50,79 +38,52 @@ type alias PartiallyDecoded = { ix : Int, nam : String, - rnk : String, - ico : String, prt : String, - lc : Struct.Location.Type, - hea : Int, - pla : Int, - ena : Bool, - dea : Bool, awp : Int, swp : Int, ar : Int, - omni : Struct.Omnimods.Type + gb : Int, + gls : (List Int), + current_omnimods : Struct.Omnimods.Type } -type Rank = - Optional - | Target - | Commander - type alias Type = { ix : Int, name : String, - rank : Rank, - icon : String, portrait : String, - location : Struct.Location.Type, - health : Int, - player_ix : Int, - enabled : Bool, - defeated : Bool, attributes : Struct.Attributes.Type, statistics : Struct.Statistics.Type, weapons : Struct.WeaponSet.Type, armor : Struct.Armor.Type, - current_omnimods : Struct.Omnimods.Type, - permanent_omnimods : Struct.Omnimods.Type + glyph_board : Struct.GlyphBoard.Type, + glyphes : (Array.Array Struct.Glyph.Type), + current_omnimods : Struct.Omnimods.Type } -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -str_to_rank : String -> Rank -str_to_rank str = - case str of - "t" -> Target - "c" -> Commander - _ -> Optional - finish_decoding : PartiallyDecoded -> (Type, Int, Int, Int) finish_decoding add_char = let weapon_set = (Struct.WeaponSet.new Struct.Weapon.none Struct.Weapon.none) armor = Struct.Armor.none + glyph_board = Struct.GlyphBoard.none + glyphes = (Array.empty) default_attributes = (Struct.Attributes.default) almost_char = { ix = add_char.ix, name = add_char.nam, - rank = (str_to_rank add_char.rnk), - icon = add_char.ico, portrait = add_char.prt, - location = add_char.lc, - health = add_char.hea, attributes = default_attributes, statistics = (Struct.Statistics.new_raw default_attributes), - player_ix = add_char.pla, - enabled = add_char.ena, - defeated = add_char.dea, weapons = weapon_set, armor = armor, - current_omnimods = (Struct.Omnimods.new [] [] [] []), - permanent_omnimods = add_char.omni + glyph_board = glyph_board, + glyphes = glyphes, + current_omnimods = add_char.current_omnimods } in (almost_char, add_char.awp, add_char.swp, add_char.ar) @@ -136,57 +97,18 @@ get_index c = c.ix get_name : Type -> String get_name c = c.name -get_rank : Type -> Rank -get_rank c = c.rank - -get_player_ix : Type -> Int -get_player_ix c = c.player_ix - -get_icon_id : Type -> String -get_icon_id c = c.icon - get_portrait_id : Type -> String get_portrait_id c = c.portrait -get_current_health : Type -> Int -get_current_health c = c.health - get_current_omnimods : Type -> Struct.Omnimods.Type get_current_omnimods c = c.current_omnimods -get_sane_current_health : Type -> Int -get_sane_current_health c = (max 0 c.health) - -set_current_health : Int -> Type -> Type -set_current_health health c = {c | health = health} - -get_location : Type -> Struct.Location.Type -get_location t = t.location - -set_location : Struct.Location.Type -> Type -> Type -set_location location char = {char | location = location} - get_attributes : Type -> Struct.Attributes.Type get_attributes char = char.attributes get_statistics : Type -> Struct.Statistics.Type get_statistics char = char.statistics -is_alive : Type -> Bool -is_alive char = ((char.health > 0) && (not char.defeated)) - -is_enabled : Type -> Bool -is_enabled char = char.enabled - -is_defeated : Type -> Bool -is_defeated char = char.defeated - -set_enabled : Bool -> Type -> Type -set_enabled enabled char = {char | enabled = enabled} - -set_defeated : Bool -> Type -> Type -set_defeated defeated char = {char | defeated = defeated} - get_weapons : Type -> Struct.WeaponSet.Type get_weapons char = char.weapons @@ -215,85 +137,15 @@ decoder = PartiallyDecoded |> (Json.Decode.Pipeline.required "ix" Json.Decode.int) |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) - |> (Json.Decode.Pipeline.required "rnk" Json.Decode.string) - |> (Json.Decode.Pipeline.required "ico" Json.Decode.string) |> (Json.Decode.Pipeline.required "prt" Json.Decode.string) - |> (Json.Decode.Pipeline.required "lc" Struct.Location.decoder) - |> (Json.Decode.Pipeline.required "hea" Json.Decode.int) - |> (Json.Decode.Pipeline.required "pla" Json.Decode.int) - |> (Json.Decode.Pipeline.required "ena" Json.Decode.bool) - |> (Json.Decode.Pipeline.required "dea" Json.Decode.bool) |> (Json.Decode.Pipeline.required "awp" Json.Decode.int) |> (Json.Decode.Pipeline.required "swp" Json.Decode.int) |> (Json.Decode.Pipeline.required "ar" Json.Decode.int) - |> (Json.Decode.Pipeline.required "pomni" Struct.Omnimods.decoder) - ) - ) - -refresh_omnimods : ( - (Struct.Location.Type -> Struct.Omnimods.Type) -> - Type -> - Type - ) -refresh_omnimods tile_omnimods_fun char = - let - previous_max_health = (Struct.Statistics.get_max_health char.statistics) - current_omnimods = - (Struct.Omnimods.merge - (Struct.Weapon.get_omnimods - (Struct.WeaponSet.get_active_weapon char.weapons) + |> (Json.Decode.Pipeline.required "gb" Json.Decode.int) + |> (Json.Decode.Pipeline.required + "gls" + (Json.Decode.list Json.Decode.int) ) - (Struct.Omnimods.merge - (tile_omnimods_fun char.location) - char.permanent_omnimods - ) - ) - current_attributes = - (Struct.Omnimods.apply_to_attributes - current_omnimods - (Struct.Attributes.default) - ) - current_statistics = - (Struct.Omnimods.apply_to_statistics - current_omnimods - (Struct.Statistics.new_raw current_attributes) - ) - new_max_health = (Struct.Statistics.get_max_health current_statistics) - in - {char | - attributes = current_attributes, - statistics = current_statistics, - current_omnimods = current_omnimods, - health = - (clamp - 1 - new_max_health - (round - ( - ((toFloat char.health) / (toFloat previous_max_health)) - * (toFloat new_max_health) - ) - ) - ) - } - -fill_missing_equipment_and_omnimods : ( - (Struct.Location.Type -> Struct.Omnimods.Type) -> - Struct.Weapon.Type -> - Struct.Weapon.Type -> - Struct.Armor.Type -> - Type -> - Type - ) -fill_missing_equipment_and_omnimods tile_omnimods_fun awp swp ar char = - (set_current_health - -- We just changed the omnimods, but already had the right health value - char.health - (refresh_omnimods - (tile_omnimods_fun) - {char | - weapons = (Struct.WeaponSet.new awp swp), - armor = ar - } + |> (Json.Decode.Pipeline.hardcoded (Struct.Omnimods.none)) ) ) diff --git a/src/roster-editor/src/Struct/Event.elm b/src/roster-editor/src/Struct/Event.elm index e95d029..b9e921c 100644 --- a/src/roster-editor/src/Struct/Event.elm +++ b/src/roster-editor/src/Struct/Event.elm @@ -20,7 +20,6 @@ type Type = | RequestedHelp Struct.HelpRequest.Type | ServerReplied (Result Http.Error (List Struct.ServerReply.Type)) | TabSelected Struct.UI.Tab - | TileSelected Struct.Location.Ref attempted : (Result.Result err val) -> Type attempted act = diff --git a/src/roster-editor/src/Struct/Glyph.elm b/src/roster-editor/src/Struct/Glyph.elm new file mode 100644 index 0000000..c9ad608 --- /dev/null +++ b/src/roster-editor/src/Struct/Glyph.elm @@ -0,0 +1,30 @@ +module Struct.Glyph exposing + ( + Type, + Ref + ) + +-- Elm ------------------------------------------------------------------------- + +-- Roster Editor --------------------------------------------------------------- +import Struct.Omnimods + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type alias Type = + { + id : Int, + name : String, + omnimods : Struct.Omnimods.Type + } + +type alias Ref = Int + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- diff --git a/src/roster-editor/src/Struct/GlyphBoard.elm b/src/roster-editor/src/Struct/GlyphBoard.elm new file mode 100644 index 0000000..43cf2da --- /dev/null +++ b/src/roster-editor/src/Struct/GlyphBoard.elm @@ -0,0 +1,38 @@ +module Struct.GlyphBoard exposing + ( + Type, + Ref, + none + ) + +-- Elm ------------------------------------------------------------------------- + +-- Roster Editor --------------------------------------------------------------- +import Struct.Omnimods + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +type alias Type = + { + id : Int, + name : String, + omnimods : Struct.Omnimods.Type + } + +type alias Ref = Int + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +none : Type +none = + { + id = 0, + name = "None", + omnimods = (Struct.Omnimods.none) + } diff --git a/src/roster-editor/src/Struct/HelpRequest.elm b/src/roster-editor/src/Struct/HelpRequest.elm index a0693e2..be78065 100644 --- a/src/roster-editor/src/Struct/HelpRequest.elm +++ b/src/roster-editor/src/Struct/HelpRequest.elm @@ -2,12 +2,10 @@ module Struct.HelpRequest exposing (Type(..)) -- Elm ------------------------------------------------------------------------- --- Map ------------------------------------------------------------------- -import Struct.Character +-- Roster Editor --------------------------------------------------------------- -------------------------------------------------------------------------------- -- TYPES ----------------------------------------------------------------------- -------------------------------------------------------------------------------- type Type = None - | HelpOnRank Struct.Character.Rank diff --git a/src/roster-editor/src/Struct/Model.elm b/src/roster-editor/src/Struct/Model.elm index 43a1fe3..4f240ed 100644 --- a/src/roster-editor/src/Struct/Model.elm +++ b/src/roster-editor/src/Struct/Model.elm @@ -22,7 +22,6 @@ import Struct.Flags -- Roster Editor --------------------------------------------------------------- import Struct.Armor import Struct.Character -import Struct.CharacterTurn import Struct.Error import Struct.HelpRequest import Struct.Omnimods diff --git a/src/roster-editor/src/Struct/Omnimods.elm b/src/roster-editor/src/Struct/Omnimods.elm index 5876454..db91ab1 100644 --- a/src/roster-editor/src/Struct/Omnimods.elm +++ b/src/roster-editor/src/Struct/Omnimods.elm @@ -3,6 +3,7 @@ module Struct.Omnimods exposing Type, new, merge, + none, apply_to_attributes, apply_to_statistics, get_attack_damage, @@ -103,6 +104,15 @@ new attribute_mods statistic_mods attack_mods defense_mods = defense = (Dict.fromList defense_mods) } +none : Type +none = + { + attributes = (Dict.empty), + statistics = (Dict.empty), + attack = (Dict.empty), + defense = (Dict.empty) + } + merge : Type -> Type -> Type merge omni_a omni_b = { diff --git a/src/roster-editor/src/Update/HandleServerReply.elm b/src/roster-editor/src/Update/HandleServerReply.elm index 22261da..5b45bb5 100644 --- a/src/roster-editor/src/Update/HandleServerReply.elm +++ b/src/roster-editor/src/Update/HandleServerReply.elm @@ -3,14 +3,10 @@ module Update.HandleServerReply exposing (apply_to) -- Elm ------------------------------------------------------------------------- import Array -import Delay - import Dict import Http -import Time - -- Shared ---------------------------------------------------------------------- import Action.Ports diff --git a/src/roster-editor/src/View/ArmorSelection.elm b/src/roster-editor/src/View/ArmorSelection.elm new file mode 100644 index 0000000..66e005b --- /dev/null +++ b/src/roster-editor/src/View/ArmorSelection.elm @@ -0,0 +1,25 @@ +module View.ArmorSelection exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Roster Editor --------------------------------------------------------------- +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + (Html.div + [(Html.Attributes.class "roster-editor-armor-selection")] + [ + (Html.text "Armor Selection") + ] + ) diff --git a/src/roster-editor/src/View/Character.elm b/src/roster-editor/src/View/Character.elm index d33feb1..8aa6217 100644 --- a/src/roster-editor/src/View/Character.elm +++ b/src/roster-editor/src/View/Character.elm @@ -9,14 +9,13 @@ import Html import Html.Attributes import Html.Events --- Map ------------------------------------------------------------------ +-- Roster Editor --------------------------------------------------------------- import Constants.UI import Util.Html import Struct.Armor import Struct.Character -import Struct.CharacterTurn import Struct.Event import Struct.Model import Struct.UI @@ -75,16 +74,7 @@ get_focus_class model char = then (Html.Attributes.class "battle-character-selected") else - if - ( - (Struct.CharacterTurn.try_getting_target model.char_turn) - == - (Just (Struct.Character.get_index char)) - ) - then - (Html.Attributes.class "battle-character-targeted") - else - (Html.Attributes.class "") + (Html.Attributes.class "") get_icon_body_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) get_icon_body_html char = diff --git a/src/roster-editor/src/View/CharacterCard.elm b/src/roster-editor/src/View/CharacterCard.elm index f3e8fb9..4592267 100644 --- a/src/roster-editor/src/View/CharacterCard.elm +++ b/src/roster-editor/src/View/CharacterCard.elm @@ -1,4 +1,4 @@ -module View.Controlled.CharacterCard exposing +module View.CharacterCard exposing ( get_minimal_html, get_summary_html, @@ -15,10 +15,8 @@ import Html.Events -- Battle ---------------------------------------------------------------------- import Struct.Armor import Struct.Character -import Struct.CharacterTurn import Struct.Event import Struct.HelpRequest -import Struct.Navigator import Struct.Omnimods import Struct.Statistics import Struct.Weapon @@ -115,38 +113,8 @@ get_statuses char = ] ) -get_active_movement_bar : ( - (Maybe Struct.Navigator.Type) -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_active_movement_bar maybe_navigator char = - let - max = - (Struct.Statistics.get_movement_points - (Struct.Character.get_statistics char) - ) - current = - case maybe_navigator of - (Just navigator) -> - (Struct.Navigator.get_remaining_points navigator) - - Nothing -> - max - in - (View.Gauge.get_html - ("MP: " ++ (toString current) ++ "/" ++ (toString max)) - (100.0 * ((toFloat current)/(toFloat max))) - [(Html.Attributes.class "roster-character-card-movement")] - [] - [] - ) - -get_inactive_movement_bar : ( - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_inactive_movement_bar char = +get_movement_bar : Struct.Character.Type -> (Html.Html Struct.Event.Type) +get_movement_bar char = let max = (Struct.Statistics.get_movement_points @@ -169,31 +137,6 @@ get_inactive_movement_bar char = [] ) -get_movement_bar : ( - Struct.CharacterTurn.Type -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_movement_bar char_turn char = - case (Struct.CharacterTurn.try_getting_active_character char_turn) of - (Just active_char) -> - if - ( - (Struct.Character.get_index active_char) - == - (Struct.Character.get_index char) - ) - then - (get_active_movement_bar - (Struct.CharacterTurn.try_getting_navigator char_turn) - active_char - ) - else - (get_inactive_movement_bar char) - - Nothing -> - (get_inactive_movement_bar char) - get_weapon_field_header : ( Float -> Struct.Weapon.Type -> @@ -433,7 +376,7 @@ get_minimal_html char = ] ), (get_health_bar char), - (get_inactive_movement_bar char), + (get_movement_bar char), (get_statuses char) ] ) @@ -473,7 +416,7 @@ get_full_html char = ] ), (get_health_bar char), - (get_inactive_movement_bar char), + (get_movement_bar char), (get_statuses char) ] ), diff --git a/src/roster-editor/src/View/CharacterSelection.elm b/src/roster-editor/src/View/CharacterSelection.elm new file mode 100644 index 0000000..063443b --- /dev/null +++ b/src/roster-editor/src/View/CharacterSelection.elm @@ -0,0 +1,25 @@ +module View.CharacterSelection exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Roster Editor --------------------------------------------------------------- +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + (Html.div + [(Html.Attributes.class "roster-editor-character-selection")] + [ + (Html.text "Character Selection") + ] + ) diff --git a/src/roster-editor/src/View/GlyphManagement.elm b/src/roster-editor/src/View/GlyphManagement.elm new file mode 100644 index 0000000..51dc151 --- /dev/null +++ b/src/roster-editor/src/View/GlyphManagement.elm @@ -0,0 +1,25 @@ +module View.GlyphManagement exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Roster Editor --------------------------------------------------------------- +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + (Html.div + [(Html.Attributes.class "roster-editor-glyph-management")] + [ + (Html.text "Glyph Management") + ] + ) diff --git a/src/roster-editor/src/View/MessageBoard.elm b/src/roster-editor/src/View/MessageBoard.elm index 736f938..433e05b 100644 --- a/src/roster-editor/src/View/MessageBoard.elm +++ b/src/roster-editor/src/View/MessageBoard.elm @@ -3,11 +3,10 @@ module View.MessageBoard exposing (get_html) -- Elm ------------------------------------------------------------------------- import Html --- Struct.Map ------------------------------------------------------------------- +-- Roster Editor --------------------------------------------------------------- import Struct.Event import Struct.Model -import View.MessageBoard.Animator import View.MessageBoard.Error import View.MessageBoard.Help @@ -22,9 +21,4 @@ get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) get_html model = case (model.error) of (Just error) -> (View.MessageBoard.Error.get_html model error) - Nothing -> - case model.animator of - (Just animator) -> - (View.MessageBoard.Animator.get_html model animator) - - Nothing -> (View.MessageBoard.Help.get_html model) + Nothing -> (View.MessageBoard.Help.get_html model) diff --git a/src/roster-editor/src/View/MessageBoard/Animator.elm b/src/roster-editor/src/View/MessageBoard/Animator.elm deleted file mode 100644 index 49bb83a..0000000 --- a/src/roster-editor/src/View/MessageBoard/Animator.elm +++ /dev/null @@ -1,57 +0,0 @@ -module View.MessageBoard.Animator exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Html - --- Map ------------------------------------------------------------------- -import Struct.Event -import Struct.Model -import Struct.TurnResult -import Struct.TurnResultAnimator - -import Util.Html - -import View.MessageBoard.Animator.Attack - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_turn_result_html : ( - Struct.Model.Type -> - Struct.TurnResult.Type -> - (Html.Html Struct.Event.Type) - ) -get_turn_result_html model turn_result = - case turn_result of - (Struct.TurnResult.Attacked attack) -> - (View.MessageBoard.Animator.Attack.get_html - model - (Struct.TurnResult.get_actor_index turn_result) - (Struct.TurnResult.get_attack_defender_index attack) - (Struct.TurnResult.maybe_get_attack_next_step attack) - ) - - _ -> (Util.Html.nothing) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : ( - Struct.Model.Type -> - Struct.TurnResultAnimator.Type -> - (Html.Html Struct.Event.Type) - ) -get_html model animator = - case (Struct.TurnResultAnimator.get_current_animation animator) of - (Struct.TurnResultAnimator.TurnResult turn_result) -> - (get_turn_result_html model turn_result) - - (Struct.TurnResultAnimator.AttackSetup (attacker_id, defender_id)) -> - (View.MessageBoard.Animator.Attack.get_html - model - attacker_id - defender_id - Nothing - ) - - _ -> (Util.Html.nothing) diff --git a/src/roster-editor/src/View/MessageBoard/Animator/Attack.elm b/src/roster-editor/src/View/MessageBoard/Animator/Attack.elm deleted file mode 100644 index 437a76d..0000000 --- a/src/roster-editor/src/View/MessageBoard/Animator/Attack.elm +++ /dev/null @@ -1,297 +0,0 @@ -module View.MessageBoard.Animator.Attack exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Array - -import Html -import Html.Attributes - --- Map ------------------------------------------------------------------- -import Struct.Attack -import Struct.Character -import Struct.Event -import Struct.Model - -import View.Controlled.CharacterCard --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_effect_text : Struct.Attack.Type -> String -get_effect_text attack = - ( - ( - case attack.precision of - Struct.Attack.Hit -> " hit for " - Struct.Attack.Graze -> " grazed for " - Struct.Attack.Miss -> " missed." - ) - ++ - ( - if (attack.precision == Struct.Attack.Miss) - then - "" - else - ( - ((toString attack.damage) ++ " damage") - ++ - ( - if (attack.critical) - then " (Critical Hit)." - else "." - ) - ) - ) - ) - -get_empty_attack_html : (Html.Html Struct.Event.Type) -get_empty_attack_html = - (Html.div - [ - (Html.Attributes.class "battle-message-attack-text") - ] - [] - ) - -get_attack_html : ( - Struct.Character.Type -> - Struct.Character.Type -> - Struct.Attack.Type -> - (Html.Html Struct.Event.Type) - ) -get_attack_html attacker defender attack = - let - attacker_name = (Struct.Character.get_name attacker) - defender_name = (Struct.Character.get_name defender) - in - (Html.div - [ - (Html.Attributes.class "battle-message-attack-text") - ] - [ - (Html.text - ( - case (attack.order, attack.parried) of - (Struct.Attack.Counter, True) -> - ( - defender_name - ++ " attempted to strike back, but " - ++ attacker_name - ++ " parried, and " - ++ (get_effect_text attack) - ) - - (Struct.Attack.Counter, _) -> - ( - defender_name - ++ " striked back, and " - ++ (get_effect_text attack) - ) - - (_, True) -> - ( - attacker_name - ++ " attempted a hit, but " - ++ defender_name - ++ " parried, and " - ++ (get_effect_text attack) - ) - - (_, _) -> - (attacker_name ++ " " ++ (get_effect_text attack)) - ) - ) - ] - ) - -get_attack_animation_class : ( - Struct.Attack.Type -> - Struct.Character.Type -> - String - ) -get_attack_animation_class attack char = - if (attack.critical) - then - "battle-animated-portrait-attack-critical" - else - "battle-animated-portrait-attacks" - -get_defense_animation_class : ( - Struct.Attack.Type -> - Struct.Character.Type -> - String - ) -get_defense_animation_class attack char = - if (attack.damage == 0) - then - if (attack.precision == Struct.Attack.Miss) - then - "battle-animated-portrait-dodges" - else - "battle-animated-portrait-undamaged" - else if ((Struct.Character.get_current_health char) > 0) - then - if (attack.precision == Struct.Attack.Graze) - then - "battle-animated-portrait-grazed-damage" - else - "battle-animated-portrait-damaged" - else - if (attack.precision == Struct.Attack.Graze) - then - "battle-animated-portrait-grazed-death" - else - "battle-animated-portrait-dies" - -get_attacker_card : ( - (Maybe Struct.Attack.Type) -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_attacker_card maybe_attack char = - (Html.div - (case maybe_attack of - Nothing -> - if ((Struct.Character.get_current_health char) > 0) - then - [ - (Html.Attributes.class "battle-animated-portrait") - ] - else - [ - (Html.Attributes.class "battle-animated-portrait-absent"), - (Html.Attributes.class "battle-animated-portrait") - ] - - (Just attack) -> - [ - (Html.Attributes.class - (case (attack.order, attack.parried) of - (Struct.Attack.Counter, True) -> - (get_attack_animation_class attack char) - - (Struct.Attack.Counter, _) -> - (get_defense_animation_class attack char) - - (_, True) -> - (get_defense_animation_class attack char) - - (_, _) -> - (get_attack_animation_class attack char) - ) - ), - (Html.Attributes.class "battle-animated-portrait") - ] - ) - [ - (View.Controlled.CharacterCard.get_minimal_html - (Struct.Character.get_player_ix char) - char - ) - ] - ) - -get_defender_card : ( - (Maybe Struct.Attack.Type) -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_defender_card maybe_attack char = - (Html.div - (case maybe_attack of - Nothing -> - if ((Struct.Character.get_current_health char) > 0) - then - [ - (Html.Attributes.class "battle-animated-portrait") - ] - else - [ - (Html.Attributes.class "battle-animated-portrait-absent"), - (Html.Attributes.class "battle-animated-portrait") - ] - - (Just attack) -> - [ - (Html.Attributes.class - (case (attack.order, attack.parried) of - (Struct.Attack.Counter, True) -> - (get_defense_animation_class attack char) - - (Struct.Attack.Counter, _) -> - (get_attack_animation_class attack char) - - (_, True) -> - (get_attack_animation_class attack char) - - (_, _) -> - (get_defense_animation_class attack char) - ) - ), - (Html.Attributes.class "battle-animated-portrait") - ] - ) - [ - (View.Controlled.CharacterCard.get_minimal_html -1 char) - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_placeholder_html : ( - (Array.Array Struct.Character.Type) -> - Int -> - Int -> - (Maybe Struct.Attack.Type) -> - (Html.Html Struct.Event.Type) - ) -get_placeholder_html characters attacker_ix defender_ix maybe_attack = - case - ( - (Array.get attacker_ix characters), - (Array.get defender_ix characters) - ) - of - ((Just atkchar), (Just defchar)) -> - (Html.div - [ - (Html.Attributes.class "battle-message-board"), - (Html.Attributes.class "battle-message-attack") - ] - ( - [ - (get_attacker_card maybe_attack atkchar), - ( - case maybe_attack of - (Just attack) -> - (get_attack_html atkchar defchar attack) - - Nothing -> - (get_empty_attack_html) - ), - (get_defender_card maybe_attack defchar) - ] - ) - ) - - _ -> - (Html.div - [ - ] - [ - (Html.text "Error: Attack with unknown characters") - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : ( - Struct.Model.Type -> - Int -> - Int -> - (Maybe Struct.Attack.Type) -> - (Html.Html Struct.Event.Type) - ) -get_html model attacker_ix defender_ix maybe_attack = - (get_placeholder_html model.characters attacker_ix defender_ix maybe_attack) diff --git a/src/roster-editor/src/View/MessageBoard/Help/Guide.elm b/src/roster-editor/src/View/MessageBoard/Help/Guide.elm index 7268c12..0c1df7e 100644 --- a/src/roster-editor/src/View/MessageBoard/Help/Guide.elm +++ b/src/roster-editor/src/View/MessageBoard/Help/Guide.elm @@ -5,7 +5,6 @@ import Html import Html.Attributes -- Map ------------------------------------------------------------------- -import Struct.CharacterTurn import Struct.Event import Struct.Model @@ -25,60 +24,6 @@ get_header_html title = ] ) -get_selected_character_html_contents : (List (Html.Html Struct.Event.Type)) -get_selected_character_html_contents = - [ - (get_header_html "Controlling a Character"), - (Html.text - ( - "Click on a target tile to select a path or use the manual" - ++ " controls (on the left panel) to make your own. Click on the" - ++ " destination tile again to confirm (this can be reverted)." - ) - ) - ] - -get_moved_character_html_contents : (List (Html.Html Struct.Event.Type)) -get_moved_character_html_contents = - [ - (get_header_html "Selecting an Action"), - (Html.text - ( - """You can now choose an action for this character. Either attack - a target in range by clicking twice on it, or switch weapons by using the menu - on the left. Dashes indicate tiles this character will be unable to defend - from. Crossed shields indicate the equivalent for the current selection.""" - ) - ) - ] - -get_chose_target_html_contents : (List (Html.Html Struct.Event.Type)) -get_chose_target_html_contents = - [ - (get_header_html "End the Turn by an Attack"), - (Html.text - ( - """A target for the attack has been selected. If you are satisfied -with your choices, you can end this character's turn and see the results unfold. -Otherwise, click on the "Undo" button to change the action, or the "Abort" -button to start this turn over.""" - ) - ) - ] - -get_switched_weapons_html_contents : (List (Html.Html Struct.Event.Type)) -get_switched_weapons_html_contents = - [ - (get_header_html "End the Turn by Switching Weapons"), - (Html.text - ( - """The character will switch weapons. If you are satisfied -with your choices, you can end this character's turn and see the results unfold. -Otherwise, click on the "Undo" button to change the action, or the "Abort" -button to start this turn over.""" - ) - ) - ] get_default_html_contents : (List (Html.Html Struct.Event.Type)) get_default_html_contents = @@ -101,19 +46,4 @@ get_html_contents : ( Struct.Model.Type -> (List (Html.Html Struct.Event.Type)) ) -get_html_contents model = - case (Struct.CharacterTurn.get_state model.char_turn) of - Struct.CharacterTurn.SelectedCharacter -> - (get_selected_character_html_contents) - - Struct.CharacterTurn.MovedCharacter -> - (get_moved_character_html_contents) - - Struct.CharacterTurn.ChoseTarget -> - (get_chose_target_html_contents) - - Struct.CharacterTurn.SwitchedWeapons -> - (get_switched_weapons_html_contents) - - _ -> - (get_default_html_contents) +get_html_contents model = (get_default_html_contents) diff --git a/src/roster-editor/src/View/PortraitSelection.elm b/src/roster-editor/src/View/PortraitSelection.elm new file mode 100644 index 0000000..bb8b1ae --- /dev/null +++ b/src/roster-editor/src/View/PortraitSelection.elm @@ -0,0 +1,25 @@ +module View.PortraitSelection exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Roster Editor --------------------------------------------------------------- +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + (Html.div + [(Html.Attributes.class "roster-editor-portrait-selection")] + [ + (Html.text "Portrait Selection") + ] + ) diff --git a/src/roster-editor/src/View/WeaponSelection.elm b/src/roster-editor/src/View/WeaponSelection.elm new file mode 100644 index 0000000..51837bb --- /dev/null +++ b/src/roster-editor/src/View/WeaponSelection.elm @@ -0,0 +1,25 @@ +module View.WeaponSelection exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes + +-- Roster Editor --------------------------------------------------------------- +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model = + (Html.div + [(Html.Attributes.class "roster-editor-weapon-selection")] + [ + (Html.text "Weapon Selection") + ] + ) -- cgit v1.2.3-70-g09d2