summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-09-07 18:38:01 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-09-07 18:38:01 +0200
commit7cba3a16cb13f8e56f39b434d6278d68e2118145 (patch)
treead435bfd82d63e3206346009e21da4498a95c325 /src/battle/src/View
parent73ac90d7f5312d887ad76b154bfee7a496a83faa (diff)
Adds "Undo" action, (move?.(attack+switch_wp)?)
Diffstat (limited to 'src/battle/src/View')
-rw-r--r--src/battle/src/View/Controlled.elm37
-rw-r--r--src/battle/src/View/MessageBoard/Help/Guide.elm35
2 files changed, 58 insertions, 14 deletions
diff --git a/src/battle/src/View/Controlled.elm b/src/battle/src/View/Controlled.elm
index e0e20bf..d0c33a5 100644
--- a/src/battle/src/View/Controlled.elm
+++ b/src/battle/src/View/Controlled.elm
@@ -47,6 +47,13 @@ abort_button =
[ (Html.text "Abort") ]
)
+undo_button : (Html.Html Struct.Event.Type)
+undo_button =
+ (Html.button
+ [ (Html.Events.onClick Struct.Event.UndoActionRequest) ]
+ [ (Html.text "Undo") ]
+ )
+
end_turn_button : String -> (Html.Html Struct.Event.Type)
end_turn_button suffix =
(Html.button
@@ -57,11 +64,19 @@ end_turn_button suffix =
[ (Html.text ("End Turn" ++ suffix)) ]
)
-inventory_button : (Html.Html Struct.Event.Type)
-inventory_button =
+inventory_button : Bool -> (Html.Html Struct.Event.Type)
+inventory_button go_prefix =
(Html.button
[ (Html.Events.onClick Struct.Event.WeaponSwitchRequest) ]
- [ (Html.text "Switch Weapon") ]
+ [
+ (Html.text
+ (
+ if (go_prefix)
+ then ("Go & Switch Weapon")
+ else ("Switch Weapon")
+ )
+ )
+ ]
)
get_available_actions : (
@@ -73,20 +88,30 @@ get_available_actions char_turn =
Struct.CharacterTurn.SelectedCharacter ->
[
(attack_button char_turn),
- (inventory_button),
+ (inventory_button (has_a_path char_turn)),
(end_turn_button " Doing Nothing"),
(abort_button)
]
Struct.CharacterTurn.MovedCharacter ->
[
- (end_turn_button " Without Attacking"),
+ (inventory_button False),
+ (end_turn_button " by Moving"),
+ (undo_button),
(abort_button)
]
Struct.CharacterTurn.ChoseTarget ->
[
- (end_turn_button " By Attacking"),
+ (end_turn_button " by Attacking"),
+ (undo_button),
+ (abort_button)
+ ]
+
+ Struct.CharacterTurn.SwitchedWeapons ->
+ [
+ (end_turn_button " by Switching Weapons"),
+ (undo_button),
(abort_button)
]
diff --git a/src/battle/src/View/MessageBoard/Help/Guide.elm b/src/battle/src/View/MessageBoard/Help/Guide.elm
index 0a41e91..7268c12 100644
--- a/src/battle/src/View/MessageBoard/Help/Guide.elm
+++ b/src/battle/src/View/MessageBoard/Help/Guide.elm
@@ -41,12 +41,13 @@ get_selected_character_html_contents =
get_moved_character_html_contents : (List (Html.Html Struct.Event.Type))
get_moved_character_html_contents =
[
- (get_header_html "Selecting a Target"),
+ (get_header_html "Selecting an Action"),
(Html.text
(
- "You can now choose a target in range. Dashed tiles indicate"
- ++ " where your character will not be able to defend themselves"
- ++ " against counter attacks."
+ """You can now choose an action for this character. Either attack
+ a target in range by clicking twice on it, or switch weapons by using the menu
+ on the left. Dashes indicate tiles this character will be unable to defend
+ from. Crossed shields indicate the equivalent for the current selection."""
)
)
]
@@ -54,12 +55,27 @@ get_moved_character_html_contents =
get_chose_target_html_contents : (List (Html.Html Struct.Event.Type))
get_chose_target_html_contents =
[
- (get_header_html "Finalizing the Character's Turn"),
+ (get_header_html "End the Turn by an Attack"),
(Html.text
(
- "If you are satisfied with your choices, you can end this"
- ++ " character's turn and see the results unfold. Otherwise, click"
- ++ " on the abort button to undo it all."
+ """A target for the attack has been selected. If you are satisfied
+with your choices, you can end this character's turn and see the results unfold.
+Otherwise, click on the "Undo" button to change the action, or the "Abort"
+button to start this turn over."""
+ )
+ )
+ ]
+
+get_switched_weapons_html_contents : (List (Html.Html Struct.Event.Type))
+get_switched_weapons_html_contents =
+ [
+ (get_header_html "End the Turn by Switching Weapons"),
+ (Html.text
+ (
+ """The character will switch weapons. If you are satisfied
+with your choices, you can end this character's turn and see the results unfold.
+Otherwise, click on the "Undo" button to change the action, or the "Abort"
+button to start this turn over."""
)
)
]
@@ -96,5 +112,8 @@ get_html_contents model =
Struct.CharacterTurn.ChoseTarget ->
(get_chose_target_html_contents)
+ Struct.CharacterTurn.SwitchedWeapons ->
+ (get_switched_weapons_html_contents)
+
_ ->
(get_default_html_contents)