summaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | src/asset/www/characters.css | 1 | ||||
-rw-r--r-- | src/asset/www/svg/icon/commander_banner.svg | 12 | ||||
-rw-r--r-- | src/asset/www/svg/icon/target_banner.svg | 123 | ||||
-rw-r--r-- | src/battlemap/src/Struct/Character.elm | 21 | ||||
-rw-r--r-- | src/battlemap/src/Struct/Tile.elm | 4 | ||||
-rw-r--r-- | src/battlemap/src/Struct/TurnResult.elm | 90 | ||||
-rw-r--r-- | src/battlemap/src/View/Battlemap/Character.elm | 36 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Status/TileInfo.elm | 35 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline.elm | 12 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline/PlayerDefeat.elm | 38 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline/PlayerTurnStart.elm | 38 | ||||
-rw-r--r-- | src/battlemap/src/View/SubMenu/Timeline/PlayerVictory.elm | 38 |
12 files changed, 414 insertions, 34 deletions
diff --git a/src/asset/www/characters.css b/src/asset/www/characters.css index 5833ca6..dedb226 100644 --- a/src/asset/www/characters.css +++ b/src/asset/www/characters.css @@ -56,3 +56,4 @@ .asset-character-team-body-7{background-image: url(/asset/svg/icon/body_team_7.svg);} .asset-character-icon-commander-banner{background-image: url(/asset/svg/icon/commander_banner.svg);} +.asset-character-icon-target-banner{background-image: url(/asset/svg/icon/target_banner.svg);} diff --git a/src/asset/www/svg/icon/commander_banner.svg b/src/asset/www/svg/icon/commander_banner.svg index be05534..572b241 100644 --- a/src/asset/www/svg/icon/commander_banner.svg +++ b/src/asset/www/svg/icon/commander_banner.svg @@ -15,7 +15,7 @@ version="1.1" id="svg8" inkscape:version="0.92.2 5c3e80d, 2017-08-06" - sodipodi:docname="commander_banner.svg"> + sodipodi:docname="commander_banner2.svg"> <defs id="defs2" /> <sodipodi:namedview @@ -26,12 +26,12 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2.2627417" - inkscape:cx="160.49674" + inkscape:cx="89.786062" inkscape:cy="128.04596" inkscape:document-units="mm" inkscape:current-layer="layer2" showgrid="false" - inkscape:window-width="1918" + inkscape:window-width="958" inkscape:window-height="1059" inkscape:window-x="1" inkscape:window-y="20" @@ -92,20 +92,20 @@ inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc" /> <path - style="opacity:1;vector-effect:none;fill:#ac9d93;fill-opacity:1;stroke:#483e37;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + style="opacity:1;vector-effect:none;fill:#28170b;fill-opacity:1;stroke:#483e37;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" d="M 12.098127,36.446804 H 31.642602 V 69.51628 c 0,0 -8.497513,-9.525 -9.772237,-9.525 -1.274724,0 -9.772238,9.525 -9.772238,9.525 z" id="rect938" inkscape:connector-curvature="0" sodipodi:nodetypes="ccczcc" /> <g aria-label="O" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:125%;font-family:Bubble_Runes;-inkscape-font-specification:Bubble_Runes;letter-spacing:0px;word-spacing:0px;fill:#483737;fill-opacity:1;stroke:#c8beb7;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:125%;font-family:Bubble_Runes;-inkscape-font-specification:Bubble_Runes;letter-spacing:0px;word-spacing:0px;fill:#e3dedb;fill-opacity:1;stroke:#483e37;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="text4594" transform="matrix(1.1384268,0,0,1.1384268,4.9151473,30.683395)"> <path inkscape:connector-curvature="0" d="m 14.179425,8.0322967 q 0.474133,-0.3612444 0.6096,-0.3612444 0.699911,0 2.144889,1.8062222 1.151466,1.4449775 2.551289,2.6416005 0.587022,0.496711 1.016,0.948266 0.451555,0.428978 0.451555,0.519289 0,0.474133 -0.451555,1.016 -0.451556,0.541867 -1.715912,1.603022 -1.873955,1.557867 -1.964266,1.8288 -0.112889,0.270934 1.670755,2.099734 1.2192,1.241777 1.490134,1.648177 0.270933,0.383823 0.270933,0.857956 0,0.587022 -0.293511,0.925689 -0.270933,0.316089 -0.903111,0.428978 -0.519289,0.112889 -0.903111,-0.158045 -0.383823,-0.270933 -1.038578,-1.196622 -0.745067,-1.083733 -1.4224,-1.851378 l -0.767645,-0.857955 -0.790222,0.880533 q -0.948267,1.128889 -1.490133,1.896533 -0.699911,1.016 -1.128889,1.286934 -0.270933,0.2032 -0.428978,0.2032 -0.158044,-0.02258 -0.541867,-0.2032 -0.519288,-0.293511 -0.8127995,-0.880534 -0.2709334,-0.6096 -0.045156,-1.038577 0.1806222,-0.361245 1.7836445,-1.986845 1.580445,-1.6256 1.512711,-1.919111 -0.02258,-0.135467 -0.6096,-0.699911 -0.564444,-0.564445 -1.377244,-1.264356 -1.4224004,-1.174044 -1.8513781,-1.715911 -0.4289778,-0.541866 -0.2709334,-0.970844 0.045156,-0.270934 1.5127115,-1.535289 1.490133,-1.286933 2.393244,-2.3932446 0.880534,-1.1288889 1.399823,-1.5578667 z m 2.302933,4.4478223 q -1.286933,-1.286933 -1.580444,-1.286933 -0.225778,0 -1.580445,1.241777 -1.354667,1.2192 -1.354667,1.399823 0,0.180622 1.354667,1.241777 1.354667,1.061156 1.557867,1.061156 0.225778,0 1.557867,-1.061156 1.332088,-1.061155 1.332088,-1.2192 0,-0.09031 -1.286933,-1.377244 z" - style="font-size:22.57777786px;fill:#483737;stroke:#c8beb7;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" + style="font-size:22.57777786px;fill:#e3dedb;stroke:#483e37;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" id="path4596" /> </g> <text diff --git a/src/asset/www/svg/icon/target_banner.svg b/src/asset/www/svg/icon/target_banner.svg new file mode 100644 index 0000000..be05534 --- /dev/null +++ b/src/asset/www/svg/icon/target_banner.svg @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="64mm" + height="76mm" + viewBox="0 0 64 76" + version="1.1" + id="svg8" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="commander_banner.svg"> + <defs + id="defs2" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="2.2627417" + inkscape:cx="160.49674" + inkscape:cy="128.04596" + inkscape:document-units="mm" + inkscape:current-layer="layer2" + showgrid="false" + inkscape:window-width="1918" + inkscape:window-height="1059" + inkscape:window-x="1" + inkscape:window-y="20" + inkscape:window-maximized="0" + inkscape:measure-start="0,0" + inkscape:measure-end="0,0" + inkscape:snap-global="false" + showguides="false" + inkscape:pagecheckerboard="true" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer6" + inkscape:label="armor" + transform="translate(0,12)" + style="display:none" + sodipodi:insensitive="true" /> + <g + inkscape:groupmode="layer" + id="layer1" + inkscape:label="armor 1" + transform="translate(0,4)" + style="display:none" + sodipodi:insensitive="true"> + <path + style="display:inline;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:1.63554144;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 60.039657,63.472577 C 61.859558,58.146591 42.408389,61.73881 33.612718,62.280518 25.29316,62.792901 7.3188069,61.397587 9.1803812,66.452264 12.206339,74.668558 56.738363,73.133887 60.039657,63.472577 Z" + id="path3716-6" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sass" /> + <path + style="fill:#396ab1;fill-opacity:1;stroke:#000000;stroke-width:2.1713829;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 55.454889,60.689954 C 52.175322,52.793703 49.24317,23.467582 36.84619,24.022441 21.129957,24.72586 8.6865466,37.525065 13.052525,63.145319 c 1.408041,8.517704 46.23925,6.78275 42.402364,-2.455365 z" + id="path3716-7" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sscs" /> + </g> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="banner" + style="display:inline"> + <path + style="opacity:1;vector-effect:none;fill:#483737;fill-opacity:1;stroke:#000000;stroke-width:0.39300048;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 19.817314,35.650031 c 2.001502,-1.360335 3.038849,-0.648021 4.106102,0 v 38.517338 c -1.3687,0.642912 -2.737402,0.670592 -4.106102,0 z" + id="rect935" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + style="opacity:1;vector-effect:none;fill:#ac9d93;fill-opacity:1;stroke:#483e37;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="M 12.098127,36.446804 H 31.642602 V 69.51628 c 0,0 -8.497513,-9.525 -9.772237,-9.525 -1.274724,0 -9.772238,9.525 -9.772238,9.525 z" + id="rect938" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccczcc" /> + <g + aria-label="O" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:125%;font-family:Bubble_Runes;-inkscape-font-specification:Bubble_Runes;letter-spacing:0px;word-spacing:0px;fill:#483737;fill-opacity:1;stroke:#c8beb7;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="text4594" + transform="matrix(1.1384268,0,0,1.1384268,4.9151473,30.683395)"> + <path + inkscape:connector-curvature="0" + d="m 14.179425,8.0322967 q 0.474133,-0.3612444 0.6096,-0.3612444 0.699911,0 2.144889,1.8062222 1.151466,1.4449775 2.551289,2.6416005 0.587022,0.496711 1.016,0.948266 0.451555,0.428978 0.451555,0.519289 0,0.474133 -0.451555,1.016 -0.451556,0.541867 -1.715912,1.603022 -1.873955,1.557867 -1.964266,1.8288 -0.112889,0.270934 1.670755,2.099734 1.2192,1.241777 1.490134,1.648177 0.270933,0.383823 0.270933,0.857956 0,0.587022 -0.293511,0.925689 -0.270933,0.316089 -0.903111,0.428978 -0.519289,0.112889 -0.903111,-0.158045 -0.383823,-0.270933 -1.038578,-1.196622 -0.745067,-1.083733 -1.4224,-1.851378 l -0.767645,-0.857955 -0.790222,0.880533 q -0.948267,1.128889 -1.490133,1.896533 -0.699911,1.016 -1.128889,1.286934 -0.270933,0.2032 -0.428978,0.2032 -0.158044,-0.02258 -0.541867,-0.2032 -0.519288,-0.293511 -0.8127995,-0.880534 -0.2709334,-0.6096 -0.045156,-1.038577 0.1806222,-0.361245 1.7836445,-1.986845 1.580445,-1.6256 1.512711,-1.919111 -0.02258,-0.135467 -0.6096,-0.699911 -0.564444,-0.564445 -1.377244,-1.264356 -1.4224004,-1.174044 -1.8513781,-1.715911 -0.4289778,-0.541866 -0.2709334,-0.970844 0.045156,-0.270934 1.5127115,-1.535289 1.490133,-1.286933 2.393244,-2.3932446 0.880534,-1.1288889 1.399823,-1.5578667 z m 2.302933,4.4478223 q -1.286933,-1.286933 -1.580444,-1.286933 -0.225778,0 -1.580445,1.241777 -1.354667,1.2192 -1.354667,1.399823 0,0.180622 1.354667,1.241777 1.354667,1.061156 1.557867,1.061156 0.225778,0 1.557867,-1.061156 1.332088,-1.061155 1.332088,-1.2192 0,-0.09031 -1.286933,-1.377244 z" + style="font-size:22.57777786px;fill:#483737;stroke:#c8beb7;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" + id="path4596" /> + </g> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:125%;font-family:Bubble_Runes;-inkscape-font-specification:Bubble_Runes;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="33.208237" + y="11.337478" + id="text943"><tspan + sodipodi:role="line" + id="tspan941" + x="33.208237" + y="21.12706" + style="stroke-width:0.26458332px" /></text> + </g> +</svg> diff --git a/src/battlemap/src/Struct/Character.elm b/src/battlemap/src/Struct/Character.elm index bb6d850..eab7b62 100644 --- a/src/battlemap/src/Struct/Character.elm +++ b/src/battlemap/src/Struct/Character.elm @@ -1,9 +1,11 @@ module Struct.Character exposing ( Type, + Rank(..), get_index, get_player_id, get_name, + get_rank, get_icon_id, get_portrait_id, get_armor, @@ -43,6 +45,7 @@ type alias PartiallyDecoded = { ix : Int, nam : String, + rnk : String, ico : String, prt : String, lc : Struct.Location.Type, @@ -55,10 +58,16 @@ type alias PartiallyDecoded = ar : Int } +type Rank = + Optional + | Target + | Commander + type alias Type = { ix : Int, name : String, + rank : Rank, icon : String, portrait : String, location : Struct.Location.Type, @@ -74,6 +83,13 @@ type alias 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 @@ -83,6 +99,7 @@ finish_decoding add_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, @@ -106,6 +123,9 @@ 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_id : Type -> String get_player_id c = c.player_id @@ -174,6 +194,7 @@ 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)) diff --git a/src/battlemap/src/Struct/Tile.elm b/src/battlemap/src/Struct/Tile.elm index 399c368..a683be3 100644 --- a/src/battlemap/src/Struct/Tile.elm +++ b/src/battlemap/src/Struct/Tile.elm @@ -14,6 +14,7 @@ module Struct.Tile exposing get_instance_cost, get_location, get_icon_id, + get_type_id, get_variant_id, solve_tile_instance, decoder @@ -154,6 +155,9 @@ get_location tile_inst = tile_inst.location get_icon_id : Instance -> String get_icon_id tile_inst = (toString tile_inst.icon_id) +get_type_id: Instance -> Int +get_type_id tile_inst = tile_inst.type_id + get_variant_id : Instance -> Int get_variant_id tile_inst = ( diff --git a/src/battlemap/src/Struct/TurnResult.elm b/src/battlemap/src/Struct/TurnResult.elm index 9ee8c79..f122e0b 100644 --- a/src/battlemap/src/Struct/TurnResult.elm +++ b/src/battlemap/src/Struct/TurnResult.elm @@ -4,6 +4,9 @@ module Struct.TurnResult exposing Attack, Movement, WeaponSwitch, + PlayerVictory, + PlayerDefeat, + PlayerTurnStart, get_next_movement_dir, get_actor_index, get_attack_defender_index, @@ -49,10 +52,28 @@ type alias WeaponSwitch = character_index : Int } +type alias PlayerVictory = + { + player_index : Int + } + +type alias PlayerDefeat = + { + player_index : Int + } + +type alias PlayerTurnStart = + { + player_index : Int + } + type Type = Moved Movement | Attacked Attack | SwitchedWeapon WeaponSwitch + | PlayerWon PlayerVictory + | PlayerLost PlayerDefeat + | PlayerTurnStarted PlayerTurnStart -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -188,6 +209,27 @@ weapon_switch_decoder = (Json.Decode.field "ix" Json.Decode.int) ) +player_won_decoder : (Json.Decode.Decoder PlayerVictory) +player_won_decoder = + (Json.Decode.map + PlayerVictory + (Json.Decode.field "ix" Json.Decode.int) + ) + +player_lost_decoder : (Json.Decode.Decoder PlayerDefeat) +player_lost_decoder = + (Json.Decode.map + PlayerDefeat + (Json.Decode.field "ix" Json.Decode.int) + ) + +player_turn_started_decoder : (Json.Decode.Decoder PlayerTurnStart) +player_turn_started_decoder = + (Json.Decode.map + PlayerTurnStart + (Json.Decode.field "ix" Json.Decode.int) + ) + internal_decoder : String -> (Json.Decode.Decoder Type) internal_decoder kind = case kind of @@ -209,6 +251,24 @@ internal_decoder kind = (attack_decoder) ) + "pwo" -> + (Json.Decode.map + (\x -> (PlayerWon x)) + (player_won_decoder) + ) + + "plo" -> + (Json.Decode.map + (\x -> (PlayerLost x)) + (player_lost_decoder) + ) + + "pts" -> + (Json.Decode.map + (\x -> (PlayerTurnStarted x)) + (player_turn_started_decoder) + ) + other -> (Json.Decode.fail ( @@ -281,6 +341,14 @@ apply_to_characters turn_result characters = (Attacked attack) -> (apply_attack_to_characters attack characters) + (PlayerWon pvict) -> characters + + (PlayerLost pdefeat) -> + -- TODO: Their characters are supposed to disappear. + characters + + (PlayerTurnStarted pturns) -> characters + apply_step_to_characters : ( Type -> (Array.Array Struct.Character.Type) -> @@ -315,6 +383,12 @@ apply_step_to_characters turn_result characters = (Attacked attack) -> (apply_attack_step_to_characters attack characters) + (PlayerWon pvict) -> characters + + (PlayerLost pdefeat) -> characters + + (PlayerTurnStarted pturns) -> characters + apply_inverse_to_characters : ( Type -> (Array.Array Struct.Character.Type) -> @@ -349,6 +423,16 @@ apply_inverse_to_characters turn_result characters = (Attacked attack) -> (apply_inverse_attack_to_characters attack characters) + (PlayerWon pvict) -> characters + + (PlayerLost pdefeat) -> + -- TODO + -- Their characters are supposed to have disappeared, so we have to + -- make them visible again. + characters + + (PlayerTurnStarted pturns) -> characters + decoder : (Json.Decode.Decoder Type) decoder = (Json.Decode.field "t" Json.Decode.string) @@ -360,6 +444,9 @@ maybe_remove_step turn_result = (Moved movement) -> (maybe_remove_movement_step movement) (SwitchedWeapon _) -> Nothing (Attacked attack) -> (maybe_remove_attack_step attack) + (PlayerWon pvict) -> Nothing + (PlayerLost pdefeat) -> Nothing + (PlayerTurnStarted pturns) -> Nothing get_next_movement_dir : Movement -> Struct.Direction.Type get_next_movement_dir movement = @@ -379,3 +466,6 @@ get_actor_index turn_result = (Moved movement) -> movement.character_index (SwitchedWeapon weapon_switch) -> weapon_switch.character_index (Attacked attack) -> attack.attacker_index + (PlayerWon pvict) -> pvict.player_index + (PlayerLost pdefeat) -> pdefeat.player_index + (PlayerTurnStarted pturns) -> pturns.player_index diff --git a/src/battlemap/src/View/Battlemap/Character.elm b/src/battlemap/src/View/Battlemap/Character.elm index 5e1b509..68b6137 100644 --- a/src/battlemap/src/View/Battlemap/Character.elm +++ b/src/battlemap/src/View/Battlemap/Character.elm @@ -148,20 +148,30 @@ get_head_html char = ] ) -get_banner_html: Struct.Character.Type -> (Html.Html Struct.Event.Type) +get_banner_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) get_banner_html char = - if ((Struct.Character.get_index char) % 8 == 0) - then - (Html.div - [ - (Html.Attributes.class "battlemap-character-icon-banner"), - (Html.Attributes.class "asset-character-icon-commander-banner") - ] - [ - ] - ) - else - (Util.Html.nothing) + case (Struct.Character.get_rank char) of + Struct.Character.Commander -> + (Html.div + [ + (Html.Attributes.class "battlemap-character-icon-banner"), + (Html.Attributes.class "asset-character-icon-commander-banner") + ] + [ + ] + ) + + Struct.Character.Target -> + (Html.div + [ + (Html.Attributes.class "battlemap-character-icon-banner"), + (Html.Attributes.class "asset-character-icon-target-banner") + ] + [ + ] + ) + + Struct.Character.Optional -> (Util.Html.nothing) get_actual_html : ( Struct.Model.Type -> diff --git a/src/battlemap/src/View/SubMenu/Status/TileInfo.elm b/src/battlemap/src/View/SubMenu/Status/TileInfo.elm index a478231..a009bc3 100644 --- a/src/battlemap/src/View/SubMenu/Status/TileInfo.elm +++ b/src/battlemap/src/View/SubMenu/Status/TileInfo.elm @@ -1,6 +1,8 @@ module View.SubMenu.Status.TileInfo exposing (get_html) -- Elm ------------------------------------------------------------------------- +import Dict + import Html import Html.Attributes @@ -14,6 +16,7 @@ import Struct.Location import Struct.Model import Struct.Tile +import Util.Html -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- @@ -46,21 +49,23 @@ get_icon tile = ] ) -get_name : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type)) -get_name tile = - (Html.div - [ - (Html.Attributes.class "battlemap-tile-card-name") - ] - [ - (Html.text - ( - "Tile.Instance " - ++ (Struct.Tile.get_icon_id tile) - ) - ) - ] +get_name : ( + Struct.Model.Type -> + Struct.Tile.Instance -> + (Html.Html Struct.Event.Type) ) +get_name model tile = + case (Dict.get (Struct.Tile.get_type_id tile) model.tiles) of + Nothing -> (Util.Html.nothing) + (Just tile_type) -> + (Html.div + [ + (Html.Attributes.class "battlemap-tile-card-name") + ] + [ + (Html.text (Struct.Tile.get_name tile_type)) + ] + ) get_cost : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type)) get_cost tile = @@ -120,7 +125,7 @@ get_html model loc = (Html.Attributes.class "battlemap-tile-card") ] [ - (get_name tile), + (get_name model tile), (Html.div [ (Html.Attributes.class "battlemap-tile-card-top") diff --git a/src/battlemap/src/View/SubMenu/Timeline.elm b/src/battlemap/src/View/SubMenu/Timeline.elm index d7e5393..5677da7 100644 --- a/src/battlemap/src/View/SubMenu/Timeline.elm +++ b/src/battlemap/src/View/SubMenu/Timeline.elm @@ -17,6 +17,9 @@ import Struct.Model import View.SubMenu.Timeline.Attack import View.SubMenu.Timeline.Movement import View.SubMenu.Timeline.WeaponSwitch +import View.SubMenu.Timeline.PlayerVictory +import View.SubMenu.Timeline.PlayerDefeat +import View.SubMenu.Timeline.PlayerTurnStart -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -50,6 +53,15 @@ get_turn_result_html characters player_id turn_result = weapon_switch ) + (Struct.TurnResult.PlayerWon pvict) -> + (View.SubMenu.Timeline.PlayerVictory.get_html pvict) + + (Struct.TurnResult.PlayerLost pdefeat) -> + (View.SubMenu.Timeline.PlayerDefeat.get_html pdefeat) + + (Struct.TurnResult.PlayerTurnStarted pturns) -> + (View.SubMenu.Timeline.PlayerTurnStart.get_html pturns) + true_get_html : ( (Array.Array Struct.Character.Type) -> String -> diff --git a/src/battlemap/src/View/SubMenu/Timeline/PlayerDefeat.elm b/src/battlemap/src/View/SubMenu/Timeline/PlayerDefeat.elm new file mode 100644 index 0000000..7bbff11 --- /dev/null +++ b/src/battlemap/src/View/SubMenu/Timeline/PlayerDefeat.elm @@ -0,0 +1,38 @@ +module View.SubMenu.Timeline.PlayerDefeat exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes +--import Html.Events + +-- Battlemap ------------------------------------------------------------------- +import Struct.Event +import Struct.TurnResult + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + Struct.TurnResult.PlayerDefeat -> + (Html.Html Struct.Event.Type) + ) +get_html pdefeat = + (Html.div + [ + (Html.Attributes.class "battlemap-timeline-element"), + (Html.Attributes.class "battlemap-timeline-player-defeat") + ] + [ + (Html.text + ( + "Player " + ++ (toString pdefeat.player_index) + ++ " has been eliminated." + ) + ) + ] + ) diff --git a/src/battlemap/src/View/SubMenu/Timeline/PlayerTurnStart.elm b/src/battlemap/src/View/SubMenu/Timeline/PlayerTurnStart.elm new file mode 100644 index 0000000..11f639e --- /dev/null +++ b/src/battlemap/src/View/SubMenu/Timeline/PlayerTurnStart.elm @@ -0,0 +1,38 @@ +module View.SubMenu.Timeline.PlayerTurnStart exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes +--import Html.Events + +-- Battlemap ------------------------------------------------------------------- +import Struct.Event +import Struct.TurnResult + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + Struct.TurnResult.PlayerTurnStart -> + (Html.Html Struct.Event.Type) + ) +get_html pturns = + (Html.div + [ + (Html.Attributes.class "battlemap-timeline-element"), + (Html.Attributes.class "battlemap-timeline-turn-start") + ] + [ + (Html.text + ( + "Player " + ++ (toString pturns.player_index) + ++ "'s turn has started." + ) + ) + ] + ) diff --git a/src/battlemap/src/View/SubMenu/Timeline/PlayerVictory.elm b/src/battlemap/src/View/SubMenu/Timeline/PlayerVictory.elm new file mode 100644 index 0000000..77494b6 --- /dev/null +++ b/src/battlemap/src/View/SubMenu/Timeline/PlayerVictory.elm @@ -0,0 +1,38 @@ +module View.SubMenu.Timeline.PlayerVictory exposing (get_html) + +-- Elm ------------------------------------------------------------------------- +import Html +import Html.Attributes +--import Html.Events + +-- Battlemap ------------------------------------------------------------------- +import Struct.Event +import Struct.TurnResult + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +get_html : ( + Struct.TurnResult.PlayerVictory -> + (Html.Html Struct.Event.Type) + ) +get_html pvict = + (Html.div + [ + (Html.Attributes.class "battlemap-timeline-element"), + (Html.Attributes.class "battlemap-timeline-player-victory") + ] + [ + (Html.text + ( + "Player " + ++ (toString pvict.player_index) + ++ " has won the battle." + ) + ) + ] + ) |