aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/battlemap/src/View/Help.elm')
-rw-r--r--src/battlemap/src/View/Help.elm124
1 files changed, 36 insertions, 88 deletions
diff --git a/src/battlemap/src/View/Help.elm b/src/battlemap/src/View/Help.elm
index 6a95aa9..7b89008 100644
--- a/src/battlemap/src/View/Help.elm
+++ b/src/battlemap/src/View/Help.elm
@@ -1,4 +1,4 @@
-module View.Footer exposing (get_html)
+module View.Help exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
@@ -6,122 +6,63 @@ import Html.Attributes
import Html.Events
-- Struct.Battlemap -------------------------------------------------------------------
-import Struct.Character
import Struct.CharacterTurn
+import Struct.Error
import Struct.Event
import Struct.Model
-import Struct.Navigator
-import Struct.Statistics
import Util.Html
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-attack_button : (Html.Html Struct.Event.Type)
-attack_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.AttackWithoutMovingRequest) ]
- [ (Html.text "Attack Without Moving") ]
- )
-
-end_turn_button : (Html.Html Struct.Event.Type)
-end_turn_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.TurnEnded) ]
- [ (Html.text "End Turn") ]
- )
-
-inventory_button : (Html.Html Struct.Event.Type)
-inventory_button =
- (Html.button
- [ (Html.Events.onClick Struct.Event.WeaponSwitchRequest) ]
- [ (Html.text "Switch Weapon") ]
- )
-
-get_navigator_info : (
- Struct.Model.Type ->
- Struct.Character.Type ->
- String
- )
-get_navigator_info model char =
- case
- (Struct.CharacterTurn.try_getting_navigator model.char_turn)
- of
- (Just nav) ->
- (
- (toString (Struct.Navigator.get_remaining_points nav))
- ++ "/"
- ++
- (toString
- (Struct.Statistics.get_movement_points
- (Struct.Character.get_statistics char)
- )
- )
- ++ " movement points remaining"
- )
-
- _ ->
- "[Error: Character selected yet navigator undefined.]"
-
-get_curr_char_info_htmls : (
+get_error_message : (
Struct.Model.Type ->
- Struct.Character.Type ->
+ Struct.Error.Type ->
(List (Html.Html Struct.Event.Type))
)
-get_curr_char_info_htmls model char =
- case
- (Struct.CharacterTurn.get_state model.char_turn)
- of
+get_error_message model error =
+ [(Html.text (Struct.Error.to_string error))]
+
+get_help_message : Struct.Model.Type -> (List (Html.Html Struct.Event.Type))
+get_help_message model =
+ case (Struct.CharacterTurn.get_state model.char_turn) of
Struct.CharacterTurn.SelectedCharacter ->
[
(Html.text
(
- "Controlling "
- ++ char.name
- ++ ". Move ("
- ++ (get_navigator_info model char)
- ++ "), "
+ "Click on a target tile to select a path or use the manual"
+ ++ " controls to make your own. Click on the destination tile"
+ ++ " again to confirm."
)
- ),
- (attack_button),
- (Html.text ", or "),
- (inventory_button)
+ )
]
Struct.CharacterTurn.MovedCharacter ->
[
(Html.text
(
- "Controlling "
- ++ char.name
- ++ ". Moved. Select a target, or "
+ "You can now choose a target in range. Dashed tiles indicate"
+ ++ " where your character will not be able to defend against"
+ ++ " counter attacks."
)
- ),
- (end_turn_button)
+ )
]
Struct.CharacterTurn.ChoseTarget ->
[
(Html.text
(
- "Controlling "
- ++ char.name
- ++ ". Moved. Chose a target. Click on "
+ "If you are satisfied with your choices, end the turn to"
+ ++ " confirm them."
)
- ),
- (end_turn_button),
- (Html.text "to end turn.")
+ )
]
_ ->
[
(Html.text
- (
- "Error: CharacterTurn structure in an inconsistent state:"
- ++ " Has an active character yet the 'state' is not any of"
- ++ " those expected in such cases."
- )
+ "Double click on an active character to play their turn."
)
]
@@ -130,13 +71,20 @@ get_curr_char_info_htmls model char =
--------------------------------------------------------------------------------
get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
- case
- (Struct.CharacterTurn.try_getting_active_character model.char_turn)
- of
- (Just char) ->
+ case (model.error) of
+ (Just error) ->
(Html.div
- [(Html.Attributes.class "battlemap-footer")]
- (get_curr_char_info_htmls model char)
+ [
+ (Html.Attributes.class "battlemap-help"),
+ (Html.Attributes.class "battlemap-error")
+ ]
+ (get_error_message model error)
)
- Nothing -> (Util.Html.nothing)
+ Nothing ->
+ (Html.div
+ [
+ (Html.Attributes.class "battlemap-help")
+ ]
+ (get_help_message model)
+ )