summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2017-11-24 17:38:15 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2017-11-24 17:38:15 +0100 |
commit | 90f4de487c3c847aa9da44adea050cea69dfb5a3 (patch) | |
tree | 4f040a50af868a3bb0c999e4b4c91c3b85647f18 /src/battlemap | |
parent | 2dd7374668d7dd91a865a8702f66a843d719ea32 (diff) |
Working on disabling chars that shouldn't be used.
Diffstat (limited to 'src/battlemap')
-rw-r--r-- | src/battlemap/src/Character.elm | 19 | ||||
-rw-r--r-- | src/battlemap/src/Model/HandleServerReply/AddChar.elm | 5 | ||||
-rw-r--r-- | src/battlemap/src/Send/LoadBattlemap.elm | 2 | ||||
-rw-r--r-- | src/battlemap/src/Shim/Model.elm | 3 | ||||
-rw-r--r-- | src/battlemap/src/View/Battlemap.elm | 9 | ||||
-rw-r--r-- | src/battlemap/www/style.css | 6 |
6 files changed, 37 insertions, 7 deletions
diff --git a/src/battlemap/src/Character.elm b/src/battlemap/src/Character.elm index 0099b0e..ed80b3c 100644 --- a/src/battlemap/src/Character.elm +++ b/src/battlemap/src/Character.elm @@ -10,7 +10,9 @@ module Character exposing get_location, set_location, get_movement_points, - get_attack_range + get_attack_range, + is_enabled, + set_enabled ) -- Battlemap ------------------------------------------------------------------- @@ -28,7 +30,8 @@ type alias Type = location : Battlemap.Location.Type, team : Int, movement_points : Int, - atk_dist : Int + atk_dist : Int, + enabled : Bool } type alias Ref = String @@ -49,9 +52,10 @@ new : ( Int -> -- team Int -> -- movement_points Int -> -- atk_dist + Bool -> -- enabled Type ) -new id name icon portrait location team movement_points atk_dist = +new id name icon portrait location team movement_points atk_dist enabled = { id = id, name = name, @@ -60,7 +64,8 @@ new id name icon portrait location team movement_points atk_dist = location = location, team = team, movement_points = movement_points, - atk_dist = atk_dist + atk_dist = atk_dist, + enabled = enabled } get_ref : Type -> Ref @@ -86,3 +91,9 @@ get_movement_points char = char.movement_points get_attack_range : Type -> Int get_attack_range char = char.atk_dist + +is_enabled : Type -> Bool +is_enabled char = char.enabled + +set_enabled : Type -> Bool -> Type +set_enabled char enabled = {char | enabled = enabled} diff --git a/src/battlemap/src/Model/HandleServerReply/AddChar.elm b/src/battlemap/src/Model/HandleServerReply/AddChar.elm index 0324faa..8924f93 100644 --- a/src/battlemap/src/Model/HandleServerReply/AddChar.elm +++ b/src/battlemap/src/Model/HandleServerReply/AddChar.elm @@ -29,7 +29,8 @@ type alias CharData = loc_y : Int, team : Int, mov_pts : Int, - atk_rg : Int + atk_rg : Int, + enabled : Bool } -------------------------------------------------------------------------------- @@ -48,6 +49,7 @@ char_decoder = |> (Json.Decode.Pipeline.required "team" Json.Decode.int) |> (Json.Decode.Pipeline.required "mov_pts" Json.Decode.int) |> (Json.Decode.Pipeline.required "atk_rg" Json.Decode.int) + |> (Json.Decode.Pipeline.required "enabled" Json.Decode.bool) ) -------------------------------------------------------------------------------- @@ -73,6 +75,7 @@ apply_to model serialized_char = char_data.team char_data.mov_pts char_data.atk_rg + char_data.enabled ) ) diff --git a/src/battlemap/src/Send/LoadBattlemap.elm b/src/battlemap/src/Send/LoadBattlemap.elm index 1aba7d7..904448d 100644 --- a/src/battlemap/src/Send/LoadBattlemap.elm +++ b/src/battlemap/src/Send/LoadBattlemap.elm @@ -32,7 +32,7 @@ try_encoding model = (Json.Encode.object [ ("session_token", (Json.Encode.string "0")), - ("player_id", (Json.Encode.string "0")), + ("player_id", (Json.Encode.string model.player_id)), ("battlemap_id", (Json.Encode.string "0")), ("instance_id", (Json.Encode.string "0")) ] diff --git a/src/battlemap/src/Shim/Model.elm b/src/battlemap/src/Shim/Model.elm index 9a3e68d..502a38d 100644 --- a/src/battlemap/src/Shim/Model.elm +++ b/src/battlemap/src/Shim/Model.elm @@ -32,7 +32,8 @@ new_char id team x y mp ad storage = portrait = id, location = {x = x, y = y}, movement_points = mp, - atk_dist = ad + atk_dist = ad, + enabled = (team == 0) } storage ) diff --git a/src/battlemap/src/View/Battlemap.elm b/src/battlemap/src/View/Battlemap.elm index beac2ab..c05644f 100644 --- a/src/battlemap/src/View/Battlemap.elm +++ b/src/battlemap/src/View/Battlemap.elm @@ -35,6 +35,15 @@ char_on_map char = (Html.div [ (Html.Attributes.class "battlemap-character-icon"), + (Html.Attributes.class + ( + if (Character.is_enabled char) + then + "battlemap-character-icon-enabled" + else + "battlemap-character-icon-disabled" + ) + ), (Html.Attributes.class "battlemap-tiled"), (Html.Attributes.class ("asset-character-icon-" ++ (Character.get_icon_id char)) diff --git a/src/battlemap/www/style.css b/src/battlemap/www/style.css index 406673a..1660547 100644 --- a/src/battlemap/www/style.css +++ b/src/battlemap/www/style.css @@ -46,6 +46,12 @@ .battlemap-can-go-to-marker {background-color:rgba(0,0,0,0.5);} .battlemap-can-attack-marker {background-color:rgba(0,0,0,0.7);} +.battlemap-character-icon-disabled +{ + opacity: 0.5; + filter: grayscale(50%); + border: 2px dotted rgba(0,0,0,0.7); +} /**** Path Icons **************************************************************/ .battlemap-path-icon-NR:before, .battlemap-path-icon-LR:before, |