| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src')
22 files changed, 98 insertions, 80 deletions
| diff --git a/src/battle/src/Action/Scroll.elm b/src/battle/src/Action/Scroll.elm index fd9e80a..c853783 100755 --- a/src/battle/src/Action/Scroll.elm +++ b/src/battle/src/Action/Scroll.elm @@ -2,7 +2,6 @@ module Action.Scroll exposing (to)  -- Elm -------------------------------------------------------------------------  import Browser.Dom -import Browser.Dom.Scroll  import Task @@ -25,38 +24,23 @@ tile_to_px ui t =        * (toFloat Constants.UI.tile_size)     ) -scroll_to_x : Int -> Struct.UI.Type -> (Task.Task Browser.Dom.Error ()) -scroll_to_x x ui = -   (Browser.Dom.Scroll.toX +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +to : Struct.Location.Type -> Struct.UI.Type -> (Task.Task Browser.Dom.Error (List ())) +to loc ui = +   (Browser.Dom.setViewportOf        Constants.UI.viewer_html_id        ( -         (tile_to_px ui x) +         (tile_to_px ui loc.x)           - Constants.UI.half_viewer_min_width           -- center on that tile, not its top left corner           + ((tile_to_px ui 1) / 2.0)        ) -   ) - -scroll_to_y : Int -> Struct.UI.Type -> (Task.Task Browser.Dom.Error ()) -scroll_to_y y ui = -   (Browser.Dom.Scroll.toY -      Constants.UI.viewer_html_id        ( -         (tile_to_px ui y) +         (tile_to_px ui loc.y)           - Constants.UI.half_viewer_min_height           -- center on that tile, not its top left corner           + ((tile_to_px ui 1) / 2.0)        )     ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -to : Struct.Location.Type -> Struct.UI.Type -> (Task.Task Browser.Dom.Error (List ())) -to loc ui = -   (Task.sequence -      [ -         (scroll_to_x loc.x ui), -         (scroll_to_y loc.y ui) -      ] -   ) diff --git a/src/battle/src/Struct/Armor.elm b/src/battle/src/Struct/Armor.elm index cc512e0..a76de34 100644 --- a/src/battle/src/Struct/Armor.elm +++ b/src/battle/src/Struct/Armor.elm @@ -52,14 +52,14 @@ get_name : Type -> String  get_name ar = ar.name  get_image_id : Type -> String -get_image_id ar = (toString ar.id) +get_image_id ar = (String.fromInt ar.id)  get_omnimods : Type -> Struct.Omnimods.Type  get_omnimods ar = ar.omnimods  decoder : (Json.Decode.Decoder Type)  decoder = -   (Json.Decode.Pipeline.decode +   (Json.Decode.succeed        Type        |> (Json.Decode.Pipeline.required "id" Json.Decode.string)        |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) diff --git a/src/battle/src/Struct/Character.elm b/src/battle/src/Struct/Character.elm index b4d3917..e180fdc 100644 --- a/src/battle/src/Struct/Character.elm +++ b/src/battle/src/Struct/Character.elm @@ -226,7 +226,7 @@ decoder : (Json.Decode.Decoder  decoder =     (Json.Decode.map        (finish_decoding) -      (Json.Decode.Pipeline.decode +      (Json.Decode.succeed           PartiallyDecoded           |> (Json.Decode.Pipeline.required "ix" Json.Decode.int)           |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) diff --git a/src/battle/src/Struct/Location.elm b/src/battle/src/Struct/Location.elm index 26e237c..da62b26 100644 --- a/src/battle/src/Struct/Location.elm +++ b/src/battle/src/Struct/Location.elm @@ -52,7 +52,7 @@ dist loc_a loc_b =  decoder : (Json.Decode.Decoder Type)  decoder = -   (Json.Decode.Pipeline.decode +   (Json.Decode.succeed        Type        |> (Json.Decode.Pipeline.required "x" Json.Decode.int)        |> (Json.Decode.Pipeline.required "y" Json.Decode.int) diff --git a/src/battle/src/Struct/Omnimods.elm b/src/battle/src/Struct/Omnimods.elm index 5876454..4ee72b2 100644 --- a/src/battle/src/Struct/Omnimods.elm +++ b/src/battle/src/Struct/Omnimods.elm @@ -51,7 +51,7 @@ generic_mods_decoder =        (Json.Decode.list           (Json.Decode.map              (\gm -> (gm.t, gm.v)) -            (Json.Decode.Pipeline.decode +            (Json.Decode.succeed                 GenericMod                 |> (Json.Decode.Pipeline.required "t" Json.Decode.string)                 |> (Json.Decode.Pipeline.required "v" Json.Decode.int) @@ -80,7 +80,7 @@ merge_mods a_mods b_mods =  --------------------------------------------------------------------------------  decoder : (Json.Decode.Decoder Type)  decoder = -   (Json.Decode.Pipeline.decode +   (Json.Decode.succeed        Type        |> (Json.Decode.Pipeline.required "attm" generic_mods_decoder)        |> (Json.Decode.Pipeline.required "stam" generic_mods_decoder) diff --git a/src/battle/src/Struct/Tile.elm b/src/battle/src/Struct/Tile.elm index b41b233..a41e561 100644 --- a/src/battle/src/Struct/Tile.elm +++ b/src/battle/src/Struct/Tile.elm @@ -178,7 +178,7 @@ solve_tile_instance tiles tile_instance =  decoder : (Json.Decode.Decoder Type)  decoder = -   (Json.Decode.Pipeline.decode +   (Json.Decode.succeed        Type        |> (Json.Decode.Pipeline.required "id" Json.Decode.string)        |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) diff --git a/src/battle/src/Struct/Weapon.elm b/src/battle/src/Struct/Weapon.elm index 0709318..21d80c5 100644 --- a/src/battle/src/Struct/Weapon.elm +++ b/src/battle/src/Struct/Weapon.elm @@ -84,7 +84,7 @@ decoder : (Json.Decode.Decoder Type)  decoder =     (Json.Decode.map        (\e -> {e | damage_sum = (Struct.Omnimods.get_damage_sum e.omnimods)}) -      (Json.Decode.Pipeline.decode +      (Json.Decode.succeed           Type           |> (Json.Decode.Pipeline.required "id" Json.Decode.string)           |> (Json.Decode.Pipeline.required "nam" Json.Decode.string) diff --git a/src/battle/src/View/Character.elm b/src/battle/src/View/Character.elm index d2b6a52..a22ca8a 100644 --- a/src/battle/src/View/Character.elm +++ b/src/battle/src/View/Character.elm @@ -55,8 +55,14 @@ get_position_style char =     let char_loc = (Struct.Character.get_location char) in        (Html.Attributes.style           [ -            ("top", ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")), -            ("left", ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px")) +            ( +               "top", +               ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px") +            ), +            ( +               "left", +               ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px") +            )           ]        ) @@ -94,7 +100,7 @@ get_icon_body_html char =           (Html.Attributes.class              (                 "asset-character-team-body-" -               ++ (toString (Struct.Character.get_player_ix char)) +               ++ (String.fromInt (Struct.Character.get_player_ix char))              )           )        ] @@ -204,7 +210,7 @@ get_portrait_html viewer_ix char =              (                 "character-portrait-team-"                 ++ -               (toString (Struct.Character.get_player_ix char)) +               (String.fromInt (Struct.Character.get_player_ix char))              )           ),           (Html.Events.onClick diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm index 08393c8..b659606 100644 --- a/src/battle/src/View/Controlled/CharacterCard.elm +++ b/src/battle/src/View/Controlled/CharacterCard.elm @@ -61,7 +61,7 @@ get_health_bar char =           )     in        (View.Gauge.get_html -         ("HP: " ++ (toString current) ++ "/" ++ (toString max)) +         ("HP: " ++ (String.fromInt current) ++ "/" ++ (String.fromInt max))           (100.0 * ((toFloat current)/(toFloat max)))           [(Html.Attributes.class "character-card-health")]           [] @@ -135,7 +135,7 @@ get_active_movement_bar maybe_navigator char =                 max     in        (View.Gauge.get_html -         ("MP: " ++ (toString current) ++ "/" ++ (toString max)) +         ("MP: " ++ (String.fromInt current) ++ "/" ++ (String.fromInt max))           (100.0 * ((toFloat current)/(toFloat max)))           [(Html.Attributes.class "character-card-movement")]           [] @@ -157,7 +157,7 @@ get_inactive_movement_bar char =           (              "MP: "              ++ -            (toString +            (String.fromInt                 (Struct.Statistics.get_movement_points                    (Struct.Character.get_statistics char)                 ) @@ -220,7 +220,7 @@ get_weapon_field_header damage_multiplier weapon =                    (                       "~"                       ++ -                     (toString +                     (String.fromInt                          (ceiling                             (                                (toFloat (Struct.Weapon.get_damage_sum weapon)) @@ -229,9 +229,10 @@ get_weapon_field_header damage_multiplier weapon =                          )                       )                       ++ " dmg @ [" -                     ++ (toString (Struct.Weapon.get_defense_range weapon)) +                     ++ +                     (String.fromInt (Struct.Weapon.get_defense_range weapon))                       ++ ", " -                     ++ (toString (Struct.Weapon.get_attack_range weapon)) +                     ++ (String.fromInt (Struct.Weapon.get_attack_range weapon))                       ++ "]"                    )                 ) @@ -251,7 +252,7 @@ get_mod_html mod =           ]           [              (Html.text -               (category ++ ": " ++ (toString value)) +               (category ++ ": " ++ (String.fromInt value))              )           ]        ) @@ -270,7 +271,7 @@ get_multiplied_mod_html multiplier mod =                 (                    category                    ++ ": " -                  ++ (toString (ceiling ((toFloat value) * multiplier))) +                  ++ (String.fromInt (ceiling ((toFloat value) * multiplier)))                 )              )           ] @@ -367,7 +368,7 @@ stat_val val perc =        [           (Html.text              ( -               (toString val) +               (String.fromInt val)                 ++                 (                    if perc diff --git a/src/battle/src/View/Controlled/Targets.elm b/src/battle/src/View/Controlled/Targets.elm index 4b27175..c92d1d4 100644 --- a/src/battle/src/View/Controlled/Targets.elm +++ b/src/battle/src/View/Controlled/Targets.elm @@ -30,10 +30,10 @@ get_target_info_html model char_ref =                 "Attacking "                 ++ char.name                 ++ " (player " -               ++ (toString (Struct.Character.get_player_ix char)) +               ++ (String.fromInt (Struct.Character.get_player_ix char))                 ++ "): "                 ++ -               (toString +               (String.fromInt                    (Struct.Statistics.get_movement_points                       (Struct.Character.get_statistics char)                    ) @@ -41,10 +41,13 @@ get_target_info_html model char_ref =                 ++ " movement points; "                 ++ "???"                 ++ " attack range. Health: " -               ++ (toString (Struct.Character.get_sane_current_health char)) +               ++ +               (String.fromInt +                  (Struct.Character.get_sane_current_health char) +               )                 ++ "/"                 ++ -               (toString +               (String.fromInt                    (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 2b9c4e0..a6bf09f 100644 --- a/src/battle/src/View/Gauge.elm +++ b/src/battle/src/View/Gauge.elm @@ -10,7 +10,7 @@ import Struct.Event  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -get_text_div: ( +get_text_div : (        String ->        List (Html.Attribute Struct.Event.Type) ->        (Html.Html Struct.Event.Type) @@ -26,7 +26,7 @@ get_text_div text extra_txt_attr =        ]     ) -get_bar_div: ( +get_bar_div : (        Float ->        List (Html.Attribute Struct.Event.Type) ->        (Html.Html Struct.Event.Type) @@ -37,7 +37,7 @@ get_bar_div percent extra_bar_attr =           [              (Html.Attributes.style                 [ -                  ("width", ((toString percent) ++ "%")) +                  ("width", ((String.fromFloat percent) ++ "%"))                 ]              ),              (Html.Attributes.class diff --git a/src/battle/src/View/Map.elm b/src/battle/src/View/Map.elm index 12e9474..0e9a7fa 100644 --- a/src/battle/src/View/Map.elm +++ b/src/battle/src/View/Map.elm @@ -38,7 +38,7 @@ get_tiles_html map =                 (                    "width",                    ( -                     (toString +                     (String.fromInt                          (                             (Struct.Map.get_width map)                             * Constants.UI.tile_size @@ -50,7 +50,7 @@ get_tiles_html map =                 (                    "height",                    ( -                     (toString +                     (String.fromInt                          (                             (Struct.Map.get_height map)                             * Constants.UI.tile_size @@ -135,7 +135,9 @@ get_html model =                          (                             "scale("                             ++ -                           (toString (Struct.UI.get_zoom_level model.ui)) +                           (String.fromFloat +                              (Struct.UI.get_zoom_level model.ui) +                           )                             ++ ")"                          )                       ) diff --git a/src/battle/src/View/Map/Character.elm b/src/battle/src/View/Map/Character.elm index 4470b4a..6ced9f0 100644 --- a/src/battle/src/View/Map/Character.elm +++ b/src/battle/src/View/Map/Character.elm @@ -88,8 +88,14 @@ get_position_style char =     let char_loc = (Struct.Character.get_location char) in        (Html.Attributes.style           [ -            ("top", ((toString (char_loc.y * Constants.UI.tile_size)) ++ "px")), -            ("left", ((toString (char_loc.x * Constants.UI.tile_size)) ++ "px")) +            ( +               "top", +               ((String.fromInt (char_loc.y * Constants.UI.tile_size)) ++ "px") +            ), +            ( +               "left", +               ((String.fromInt (char_loc.x * Constants.UI.tile_size)) ++ "px") +            )           ]        ) @@ -127,7 +133,7 @@ get_body_html char =           (Html.Attributes.class              (                 "asset-character-team-body-" -               ++ (toString (Struct.Character.get_player_ix char)) +               ++ (String.fromInt (Struct.Character.get_player_ix char))              )           )        ] diff --git a/src/battle/src/View/Map/Navigator.elm b/src/battle/src/View/Map/Navigator.elm index c4b430f..79dd3b0 100644 --- a/src/battle/src/View/Map/Navigator.elm +++ b/src/battle/src/View/Map/Navigator.elm @@ -56,11 +56,17 @@ marker_get_html is_interactive (loc_ref, marker) =                       [                          (                             "top", -                           ((toString (loc.y * Constants.UI.tile_size)) ++ "px") +                           ( +                              (String.fromInt (loc.y * Constants.UI.tile_size)) +                              ++ "px" +                           )                          ),                          (                             "left", -                           ((toString (loc.x * Constants.UI.tile_size)) ++ "px") +                           ( +                              (String.fromInt (loc.x * Constants.UI.tile_size)) +                              ++ "px" +                           )                          )                       ]                 ) @@ -151,7 +157,9 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =                       (                          "top",                          ( -                           (toString (curr_loc.y * Constants.UI.tile_size)) +                           (String.fromInt +                              (curr_loc.y * Constants.UI.tile_size) +                           )                             ++                             "px"                          ) @@ -159,7 +167,9 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =                       (                          "left",                          ( -                           (toString (curr_loc.x * Constants.UI.tile_size)) +                           (String.fromInt +                              (curr_loc.x * Constants.UI.tile_size) +                           )                             ++                             "px"                          ) @@ -200,11 +210,11 @@ mark_the_spot loc origin_dir =              [                 (                    "top", -                  ((toString (loc.y * Constants.UI.tile_size)) ++ "px") +                  ((String.fromInt (loc.y * Constants.UI.tile_size)) ++ "px")                 ),                 (                    "left", -                  ((toString (loc.x * Constants.UI.tile_size)) ++ "px") +                  ((String.fromInt (loc.x * Constants.UI.tile_size)) ++ "px")                 )              ]           ) diff --git a/src/battle/src/View/Map/Tile.elm b/src/battle/src/View/Map/Tile.elm index 7bccf98..f2f3003 100644 --- a/src/battle/src/View/Map/Tile.elm +++ b/src/battle/src/View/Map/Tile.elm @@ -24,7 +24,7 @@ get_layer_html : (  get_layer_html index border =     (Html.div        [ -         (Html.Attributes.class ("tile-icon-f-" ++ (toString index))), +         (Html.Attributes.class ("tile-icon-f-" ++ (String.fromInt index))),           (Html.Attributes.style              [                 ( @@ -110,7 +110,7 @@ get_html tile =              (Html.Attributes.class                 (                    "tile-variant-" -                  ++ (toString (Struct.Tile.get_local_variant_ix tile)) +                  ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile))                 )              ),              (Html.Attributes.class "clickable"), @@ -121,11 +121,17 @@ get_html tile =                 [                    (                       "top", -                     ((toString (tile_loc.y * Constants.UI.tile_size)) ++ "px") +                     ( +                        (String.fromInt (tile_loc.y * Constants.UI.tile_size)) +                        ++ "px" +                     )                    ),                    (                       "left", -                     ((toString (tile_loc.x * Constants.UI.tile_size)) ++ "px") +                     ( +                        (String.fromInt (tile_loc.x * Constants.UI.tile_size)) +                        ++ "px" +                     )                    )                 ]              ) diff --git a/src/battle/src/View/MessageBoard/Animator/Attack.elm b/src/battle/src/View/MessageBoard/Animator/Attack.elm index 78c1f49..b715ac5 100644 --- a/src/battle/src/View/MessageBoard/Animator/Attack.elm +++ b/src/battle/src/View/MessageBoard/Animator/Attack.elm @@ -32,7 +32,7 @@ get_effect_text attack =              ""           else              ( -               ((toString attack.damage) ++ " damage") +               ((String.fromInt attack.damage) ++ " damage")                 ++                 (                    if (attack.critical) diff --git a/src/battle/src/View/SubMenu/Status/TileInfo.elm b/src/battle/src/View/SubMenu/Status/TileInfo.elm index 1dbe8f6..bc382fc 100644 --- a/src/battle/src/View/SubMenu/Status/TileInfo.elm +++ b/src/battle/src/View/SubMenu/Status/TileInfo.elm @@ -32,7 +32,7 @@ get_icon tile =           (Html.Attributes.class              (                 "tile-variant-" -               ++ (toString (Struct.Tile.get_local_variant_ix tile)) +               ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile))              )           )        ] @@ -68,7 +68,7 @@ get_cost tile =           then              "Obstructed"           else -            ("Cost: " ++ (toString cost)) +            ("Cost: " ++ (String.fromInt cost))     in        (Html.div           [ @@ -94,9 +94,9 @@ get_location tile =              (Html.text                 (                    "{x: " -                  ++ (toString tile_location.x) +                  ++ (String.fromInt tile_location.x)                    ++ "; y: " -                  ++ (toString tile_location.y) +                  ++ (String.fromInt tile_location.y)                    ++ "}"                 )              ) @@ -114,7 +114,7 @@ get_mod_html mod =           ]           [              (Html.text -               (category ++ ": " ++ (toString value)) +               (category ++ ": " ++ (String.fromInt value))              )           ]        ) diff --git a/src/battle/src/View/SubMenu/Timeline/Attack.elm b/src/battle/src/View/SubMenu/Timeline/Attack.elm index 6ba8cd0..3eb3a04 100644 --- a/src/battle/src/View/SubMenu/Timeline/Attack.elm +++ b/src/battle/src/View/SubMenu/Timeline/Attack.elm @@ -56,7 +56,7 @@ get_effect_text attack =              ""           else              ( -               ((toString attack.damage) ++ " damage") +               ((String.fromInt attack.damage) ++ " damage")                 ++                 (                    if (attack.critical) diff --git a/src/battle/src/View/SubMenu/Timeline/Movement.elm b/src/battle/src/View/SubMenu/Timeline/Movement.elm index e3be53d..028453c 100644 --- a/src/battle/src/View/SubMenu/Timeline/Movement.elm +++ b/src/battle/src/View/SubMenu/Timeline/Movement.elm @@ -41,9 +41,9 @@ get_html characters player_ix movement =                    (                       (Struct.Character.get_name char)                       ++ " moved to (" -                     ++ (toString movement.destination.x) +                     ++ (String.fromInt movement.destination.x)                       ++ ", " -                     ++ (toString movement.destination.y) +                     ++ (String.fromInt movement.destination.y)                       ++ ")."                    )                 ) diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm b/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm index 1d91c9a..b2afd6e 100644 --- a/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm +++ b/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm @@ -30,7 +30,7 @@ get_html pdefeat =           (Html.text              (                 "Player " -               ++ (toString pdefeat.player_index) +               ++ (String.fromInt pdefeat.player_index)                 ++ " has been eliminated."              )           ) diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm b/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm index 233e03c..1c4b829 100644 --- a/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm +++ b/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm @@ -30,7 +30,7 @@ get_html pturns =           (Html.text              (                 "Player " -               ++ (toString pturns.player_index) +               ++ (String.fromInt pturns.player_index)                 ++ "'s turn has started."              )           ) diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm b/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm index 9728f04..9f166e4 100644 --- a/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm +++ b/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm @@ -30,7 +30,7 @@ get_html pvict =           (Html.text              (                 "Player " -               ++ (toString pvict.player_index) +               ++ (String.fromInt pvict.player_index)                 ++ " has won the map."              )           ) | 


