summaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | src/battlemap/src/Character.elm | 21 | ||||
-rw-r--r-- | src/battlemap/src/Event.elm | 2 | ||||
-rw-r--r-- | src/battlemap/src/Model/HandleServerReply/AddChar.elm | 6 | ||||
-rw-r--r-- | src/battlemap/src/View/Footer/TabMenu/Status.elm | 5 |
4 files changed, 30 insertions, 4 deletions
diff --git a/src/battlemap/src/Character.elm b/src/battlemap/src/Character.elm index ed80b3c..31337f7 100644 --- a/src/battlemap/src/Character.elm +++ b/src/battlemap/src/Character.elm @@ -7,6 +7,8 @@ module Character exposing get_team, get_icon_id, get_portrait_id, + get_current_health, + get_max_health, get_location, set_location, get_movement_points, @@ -28,6 +30,8 @@ type alias Type = icon : String, portrait : String, location : Battlemap.Location.Type, + health : Int, + max_health : Int, team : Int, movement_points : Int, atk_dist : Int, @@ -48,6 +52,8 @@ new : ( String -> -- name String -> -- icon String -> -- portrait + Int -> -- health + Int -> -- max_health Battlemap.Location.Type -> -- location Int -> -- team Int -> -- movement_points @@ -55,12 +61,19 @@ new : ( Bool -> -- enabled Type ) -new id name icon portrait location team movement_points atk_dist enabled = +new + id name icon portrait + health max_health + location + team movement_points atk_dist + enabled = { id = id, name = name, icon = icon, portrait = portrait, + health = health, + max_health = max_health, location = location, team = team, movement_points = movement_points, @@ -80,6 +93,12 @@ 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_max_health : Type -> Int +get_max_health c = c.max_health + get_location : Type -> Battlemap.Location.Type get_location t = t.location diff --git a/src/battlemap/src/Event.elm b/src/battlemap/src/Event.elm index 21bbcb6..1a6f2e5 100644 --- a/src/battlemap/src/Event.elm +++ b/src/battlemap/src/Event.elm @@ -1,7 +1,5 @@ module Event exposing (Type(..)) -import Dict - import Http import Battlemap.Direction diff --git a/src/battlemap/src/Model/HandleServerReply/AddChar.elm b/src/battlemap/src/Model/HandleServerReply/AddChar.elm index f6aaf4b..f5f30ba 100644 --- a/src/battlemap/src/Model/HandleServerReply/AddChar.elm +++ b/src/battlemap/src/Model/HandleServerReply/AddChar.elm @@ -20,6 +20,8 @@ type alias CharData = name : String, icon : String, portrait : String, + health : Int, + max_health : Int, loc_x : Int, loc_y : Int, team : Int, @@ -39,6 +41,8 @@ char_decoder = |> (Json.Decode.Pipeline.required "name" Json.Decode.string) |> (Json.Decode.Pipeline.required "icon" Json.Decode.string) |> (Json.Decode.Pipeline.required "portrait" Json.Decode.string) + |> (Json.Decode.Pipeline.required "health" Json.Decode.int) + |> (Json.Decode.Pipeline.required "max_health" Json.Decode.int) |> (Json.Decode.Pipeline.required "loc_x" Json.Decode.int) |> (Json.Decode.Pipeline.required "loc_y" Json.Decode.int) |> (Json.Decode.Pipeline.required "team" Json.Decode.int) @@ -66,6 +70,8 @@ apply_to model serialized_char = char_data.name char_data.icon char_data.portrait + char_data.health + char_data.max_health {x = char_data.loc_x, y = char_data.loc_y} char_data.team char_data.mov_pts diff --git a/src/battlemap/src/View/Footer/TabMenu/Status.elm b/src/battlemap/src/View/Footer/TabMenu/Status.elm index 5fc5775..5697cba 100644 --- a/src/battlemap/src/View/Footer/TabMenu/Status.elm +++ b/src/battlemap/src/View/Footer/TabMenu/Status.elm @@ -60,7 +60,10 @@ get_char_info_html model char_ref = ++ (toString (Character.get_movement_points char)) ++ " movement points; " ++ (toString (Character.get_attack_range char)) - ++ " attack range." + ++ " attack range. Health: " + ++ (toString (Character.get_current_health char)) + ++ "/" + ++ (toString (Character.get_max_health char)) ) ) |