summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/map-editor/src/View/MessageBoard')
-rw-r--r-- | src/map-editor/src/View/MessageBoard/Animator.elm | 57 | ||||
-rw-r--r-- | src/map-editor/src/View/MessageBoard/Animator/Attack.elm | 297 | ||||
-rw-r--r-- | src/map-editor/src/View/MessageBoard/Error.elm | 4 | ||||
-rw-r--r-- | src/map-editor/src/View/MessageBoard/Help.elm | 8 | ||||
-rw-r--r-- | src/map-editor/src/View/MessageBoard/Help/Guide.elm | 56 | ||||
-rw-r--r-- | src/map-editor/src/View/MessageBoard/Help/Rank.elm | 97 |
6 files changed, 6 insertions, 513 deletions
diff --git a/src/map-editor/src/View/MessageBoard/Animator.elm b/src/map-editor/src/View/MessageBoard/Animator.elm deleted file mode 100644 index 5c8938b..0000000 --- a/src/map-editor/src/View/MessageBoard/Animator.elm +++ /dev/null @@ -1,57 +0,0 @@ -module View.MessageBoard.Animator exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Html - --- Battlemap ------------------------------------------------------------------- -import Struct.Event -import Struct.Model -import Struct.TurnResult -import Struct.TurnResultAnimator - -import Util.Html - -import View.MessageBoard.Animator.Attack - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_turn_result_html : ( - Struct.Model.Type -> - Struct.TurnResult.Type -> - (Html.Html Struct.Event.Type) - ) -get_turn_result_html model turn_result = - case turn_result of - (Struct.TurnResult.Attacked attack) -> - (View.MessageBoard.Animator.Attack.get_html - model - (Struct.TurnResult.get_actor_index turn_result) - (Struct.TurnResult.get_attack_defender_index attack) - (Struct.TurnResult.maybe_get_attack_next_step attack) - ) - - _ -> (Util.Html.nothing) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : ( - Struct.Model.Type -> - Struct.TurnResultAnimator.Type -> - (Html.Html Struct.Event.Type) - ) -get_html model animator = - case (Struct.TurnResultAnimator.get_current_animation animator) of - (Struct.TurnResultAnimator.TurnResult turn_result) -> - (get_turn_result_html model turn_result) - - (Struct.TurnResultAnimator.AttackSetup (attacker_id, defender_id)) -> - (View.MessageBoard.Animator.Attack.get_html - model - attacker_id - defender_id - Nothing - ) - - _ -> (Util.Html.nothing) diff --git a/src/map-editor/src/View/MessageBoard/Animator/Attack.elm b/src/map-editor/src/View/MessageBoard/Animator/Attack.elm deleted file mode 100644 index 211ada4..0000000 --- a/src/map-editor/src/View/MessageBoard/Animator/Attack.elm +++ /dev/null @@ -1,297 +0,0 @@ -module View.MessageBoard.Animator.Attack exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Array - -import Html -import Html.Attributes - --- Battlemap ------------------------------------------------------------------- -import Struct.Attack -import Struct.Character -import Struct.Event -import Struct.Model - -import View.Controlled.CharacterCard --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_effect_text : Struct.Attack.Type -> String -get_effect_text attack = - ( - ( - case attack.precision of - Struct.Attack.Hit -> " hit for " - Struct.Attack.Graze -> " grazed for " - Struct.Attack.Miss -> " missed." - ) - ++ - ( - if (attack.precision == Struct.Attack.Miss) - then - "" - else - ( - ((toString attack.damage) ++ " damage") - ++ - ( - if (attack.critical) - then " (Critical Hit)." - else "." - ) - ) - ) - ) - -get_empty_attack_html : (Html.Html Struct.Event.Type) -get_empty_attack_html = - (Html.div - [ - (Html.Attributes.class "battlemap-message-attack-text") - ] - [] - ) - -get_attack_html : ( - Struct.Character.Type -> - Struct.Character.Type -> - Struct.Attack.Type -> - (Html.Html Struct.Event.Type) - ) -get_attack_html attacker defender attack = - let - attacker_name = (Struct.Character.get_name attacker) - defender_name = (Struct.Character.get_name defender) - in - (Html.div - [ - (Html.Attributes.class "battlemap-message-attack-text") - ] - [ - (Html.text - ( - case (attack.order, attack.parried) of - (Struct.Attack.Counter, True) -> - ( - defender_name - ++ " attempted to strike back, but " - ++ attacker_name - ++ " parried, and " - ++ (get_effect_text attack) - ) - - (Struct.Attack.Counter, _) -> - ( - defender_name - ++ " striked back, and " - ++ (get_effect_text attack) - ) - - (_, True) -> - ( - attacker_name - ++ " attempted a hit, but " - ++ defender_name - ++ " parried, and " - ++ (get_effect_text attack) - ) - - (_, _) -> - (attacker_name ++ " " ++ (get_effect_text attack)) - ) - ) - ] - ) - -get_attack_animation_class : ( - Struct.Attack.Type -> - Struct.Character.Type -> - String - ) -get_attack_animation_class attack char = - if (attack.critical) - then - "battlemap-animated-portrait-attack-critical" - else - "battlemap-animated-portrait-attacks" - -get_defense_animation_class : ( - Struct.Attack.Type -> - Struct.Character.Type -> - String - ) -get_defense_animation_class attack char = - if (attack.damage == 0) - then - if (attack.precision == Struct.Attack.Miss) - then - "battlemap-animated-portrait-dodges" - else - "battlemap-animated-portrait-undamaged" - else if ((Struct.Character.get_current_health char) > 0) - then - if (attack.precision == Struct.Attack.Graze) - then - "battlemap-animated-portrait-grazed-damage" - else - "battlemap-animated-portrait-damaged" - else - if (attack.precision == Struct.Attack.Graze) - then - "battlemap-animated-portrait-grazed-death" - else - "battlemap-animated-portrait-dies" - -get_attacker_card : ( - (Maybe Struct.Attack.Type) -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_attacker_card maybe_attack char = - (Html.div - (case maybe_attack of - Nothing -> - if ((Struct.Character.get_current_health char) > 0) - then - [ - (Html.Attributes.class "battlemap-animated-portrait") - ] - else - [ - (Html.Attributes.class "battlemap-animated-portrait-absent"), - (Html.Attributes.class "battlemap-animated-portrait") - ] - - (Just attack) -> - [ - (Html.Attributes.class - (case (attack.order, attack.parried) of - (Struct.Attack.Counter, True) -> - (get_attack_animation_class attack char) - - (Struct.Attack.Counter, _) -> - (get_defense_animation_class attack char) - - (_, True) -> - (get_defense_animation_class attack char) - - (_, _) -> - (get_attack_animation_class attack char) - ) - ), - (Html.Attributes.class "battlemap-animated-portrait") - ] - ) - [ - (View.Controlled.CharacterCard.get_minimal_html - (Struct.Character.get_player_ix char) - char - ) - ] - ) - -get_defender_card : ( - (Maybe Struct.Attack.Type) -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_defender_card maybe_attack char = - (Html.div - (case maybe_attack of - Nothing -> - if ((Struct.Character.get_current_health char) > 0) - then - [ - (Html.Attributes.class "battlemap-animated-portrait") - ] - else - [ - (Html.Attributes.class "battlemap-animated-portrait-absent"), - (Html.Attributes.class "battlemap-animated-portrait") - ] - - (Just attack) -> - [ - (Html.Attributes.class - (case (attack.order, attack.parried) of - (Struct.Attack.Counter, True) -> - (get_defense_animation_class attack char) - - (Struct.Attack.Counter, _) -> - (get_attack_animation_class attack char) - - (_, True) -> - (get_attack_animation_class attack char) - - (_, _) -> - (get_defense_animation_class attack char) - ) - ), - (Html.Attributes.class "battlemap-animated-portrait") - ] - ) - [ - (View.Controlled.CharacterCard.get_minimal_html -1 char) - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_placeholder_html : ( - (Array.Array Struct.Character.Type) -> - Int -> - Int -> - (Maybe Struct.Attack.Type) -> - (Html.Html Struct.Event.Type) - ) -get_placeholder_html characters attacker_ix defender_ix maybe_attack = - case - ( - (Array.get attacker_ix characters), - (Array.get defender_ix characters) - ) - of - ((Just atkchar), (Just defchar)) -> - (Html.div - [ - (Html.Attributes.class "battlemap-message-board"), - (Html.Attributes.class "battlemap-message-attack") - ] - ( - [ - (get_attacker_card maybe_attack atkchar), - ( - case maybe_attack of - (Just attack) -> - (get_attack_html atkchar defchar attack) - - Nothing -> - (get_empty_attack_html) - ), - (get_defender_card maybe_attack defchar) - ] - ) - ) - - _ -> - (Html.div - [ - ] - [ - (Html.text "Error: Attack with unknown characters") - ] - ) - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html : ( - Struct.Model.Type -> - Int -> - Int -> - (Maybe Struct.Attack.Type) -> - (Html.Html Struct.Event.Type) - ) -get_html model attacker_ix defender_ix maybe_attack = - (get_placeholder_html model.characters attacker_ix defender_ix maybe_attack) diff --git a/src/map-editor/src/View/MessageBoard/Error.elm b/src/map-editor/src/View/MessageBoard/Error.elm index 642634a..5e961a7 100644 --- a/src/map-editor/src/View/MessageBoard/Error.elm +++ b/src/map-editor/src/View/MessageBoard/Error.elm @@ -24,8 +24,8 @@ get_html : ( get_html model error = (Html.div [ - (Html.Attributes.class "battlemap-message-board"), - (Html.Attributes.class "battlemap-error") + (Html.Attributes.class "map-message-board"), + (Html.Attributes.class "map-error") ] [ (Html.text (Struct.Error.to_string error)) diff --git a/src/map-editor/src/View/MessageBoard/Help.elm b/src/map-editor/src/View/MessageBoard/Help.elm index 15a33a5..4225518 100644 --- a/src/map-editor/src/View/MessageBoard/Help.elm +++ b/src/map-editor/src/View/MessageBoard/Help.elm @@ -10,7 +10,6 @@ import Struct.HelpRequest import Struct.Model import View.MessageBoard.Help.Guide -import View.MessageBoard.Help.Rank -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- @@ -23,15 +22,12 @@ get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) get_html model = (Html.div [ - (Html.Attributes.class "battlemap-message-board"), - (Html.Attributes.class "battlemap-message-board-help") + (Html.Attributes.class "map-message-board"), + (Html.Attributes.class "map-message-board-help") ] ( case model.help_request of Struct.HelpRequest.None -> (View.MessageBoard.Help.Guide.get_html_contents model) - - (Struct.HelpRequest.HelpOnRank rank) -> - (View.MessageBoard.Help.Rank.get_html_contents rank) ) ) diff --git a/src/map-editor/src/View/MessageBoard/Help/Guide.elm b/src/map-editor/src/View/MessageBoard/Help/Guide.elm index a10b96e..526abf0 100644 --- a/src/map-editor/src/View/MessageBoard/Help/Guide.elm +++ b/src/map-editor/src/View/MessageBoard/Help/Guide.elm @@ -5,7 +5,6 @@ import Html import Html.Attributes -- Battlemap ------------------------------------------------------------------- -import Struct.CharacterTurn import Struct.Event import Struct.Model @@ -18,52 +17,13 @@ get_header_html title = [] [ (Html.div - [(Html.Attributes.class "battlemap-help-guide-icon")] + [(Html.Attributes.class "map-help-guide-icon")] [] ), (Html.text title) ] ) -get_selected_character_html_contents : (List (Html.Html Struct.Event.Type)) -get_selected_character_html_contents = - [ - (get_header_html "Controlling a Character"), - (Html.text - ( - "Click on a target tile to select a path or use the manual" - ++ " controls (on the left panel) to make your own. Click on the" - ++ " destination tile again to confirm (this can be reverted)." - ) - ) - ] - -get_moved_character_html_contents : (List (Html.Html Struct.Event.Type)) -get_moved_character_html_contents = - [ - (get_header_html "Selecting a Target"), - (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." - ) - ) - ] - -get_chose_target_html_contents : (List (Html.Html Struct.Event.Type)) -get_chose_target_html_contents = - [ - (get_header_html "Finalizing the Character's Turn"), - (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." - ) - ) - ] - get_default_html_contents : (List (Html.Html Struct.Event.Type)) get_default_html_contents = [ @@ -85,16 +45,4 @@ get_html_contents : ( Struct.Model.Type -> (List (Html.Html Struct.Event.Type)) ) -get_html_contents model = - case (Struct.CharacterTurn.get_state model.char_turn) of - Struct.CharacterTurn.SelectedCharacter -> - (get_selected_character_html_contents) - - Struct.CharacterTurn.MovedCharacter -> - (get_moved_character_html_contents) - - Struct.CharacterTurn.ChoseTarget -> - (get_chose_target_html_contents) - - _ -> - (get_default_html_contents) +get_html_contents model = (get_default_html_contents) diff --git a/src/map-editor/src/View/MessageBoard/Help/Rank.elm b/src/map-editor/src/View/MessageBoard/Help/Rank.elm deleted file mode 100644 index 95477d3..0000000 --- a/src/map-editor/src/View/MessageBoard/Help/Rank.elm +++ /dev/null @@ -1,97 +0,0 @@ -module View.MessageBoard.Help.Rank exposing (get_html_contents) - --- Elm ------------------------------------------------------------------------- -import Html -import Html.Attributes - --- Battlemap ------------------------------------------------------------------- -import Struct.Character -import Struct.Event - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_guide_icon_html : (Html.Html Struct.Event.Type) -get_guide_icon_html = - (Html.div - [(Html.Attributes.class "battlemap-help-guide-icon")] - [] - ) - -get_header_with_icon_html : String -> String -> (Html.Html Struct.Event.Type) -get_header_with_icon_html title rank_name = - (Html.h1 - [] - [ - (get_guide_icon_html), - (Html.text (title ++ " - ")), - (Html.div - [ - (Html.Attributes.class - "battlemap-message-board-help-figure" - ), - (Html.Attributes.class - ("battlemap-character-card-" ++ rank_name ++ "-status") - ) - ] - [] - ) - ] - ) - -get_target_help_message : (List (Html.Html Struct.Event.Type)) -get_target_help_message = - [ - (get_header_with_icon_html "Protected Character" "target"), - (Html.text - ( - "Players that lose all of their Protected Characters are" - ++ " eliminated." - ) - ) - ] - -get_commander_help_message : (List (Html.Html Struct.Event.Type)) -get_commander_help_message = - [ - (get_header_with_icon_html "Critical Character" "commander"), - (Html.text - ( - "Players that lose any of their Critical Characters are" - ++ " eliminated." - ) - ) - ] - -get_optional_help_message : (List (Html.Html Struct.Event.Type)) -get_optional_help_message = - [ - (Html.h1 - [] - [ - (get_guide_icon_html), - (Html.text "Reinforcement Character") - ] - ), - (Html.text - ( - "Unless it is their very last character, losing a" - ++ " Reinforcement characters never causes a player to be" - ++ " eliminated." - ) - ) - ] - - --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_html_contents : ( - Struct.Character.Rank -> - (List (Html.Html Struct.Event.Type)) - ) -get_html_contents rank = - case rank of - Struct.Character.Target -> (get_target_help_message) - Struct.Character.Commander -> (get_commander_help_message) - Struct.Character.Optional -> (get_optional_help_message) |