aboutsummaryrefslogtreecommitdiff
blob: 7bb4c36a77bab50f70f06a6667baa23225e8784d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
module View.SideBar.Targets exposing (get_html)

-- Elm -------------------------------------------------------------------------
import Dict

import Html
import Html.Attributes

-- Battlemap -------------------------------------------------------------------
import Struct.Character
import Struct.Event
import Struct.Model
import Struct.Statistics

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------

get_target_info_html : (
      Struct.Model.Type ->
      Struct.Character.Ref ->
      (Html.Html Struct.Event.Type)
   )
get_target_info_html model char_ref =
   case (Dict.get char_ref model.characters) of
      Nothing -> (Html.text "Error: Unknown character selected.")
      (Just char) ->
         (Html.text
            (
               "Attacking "
               ++ char.name
               ++ " (player "
               ++ (Struct.Character.get_player_id char)
               ++ "): "
               ++
               (toString
                  (Struct.Statistics.get_movement_points
                     (Struct.Character.get_statistics char)
                  )
               )
               ++ " movement points; "
               ++ "???"
               ++ " attack range. Health: "
               ++ (toString (Struct.Character.get_current_health char))
               ++ "/"
               ++
               (toString
                  (Struct.Statistics.get_max_health
                     (Struct.Character.get_statistics char)
                  )
               )
            )
         )

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
      Struct.Model.Type ->
      Struct.Character.Ref ->
      (Html.Html Struct.Event.Type)
   )
get_html model target_ref =
   (Html.div
      [
         (Html.Attributes.class "battlemap-side-bar-targets")
      ]
      [(get_target_info_html model target_ref)]
   )