| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2020-01-14 17:55:15 +0100 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2020-01-14 17:55:15 +0100 | 
| commit | dc7c1857845a5da7cd6cba178c16fa8ea8c68cec (patch) | |
| tree | 0fd4fcbbbabd3654995abe6e5d6716d0213763ba /src/battle | |
| parent | 0db9aabba95a33fd23c192343721559f9ca15581 (diff) | |
...
Diffstat (limited to 'src/battle')
| -rw-r--r-- | src/battle/src/Struct/Battle.elm | 40 | ||||
| -rw-r--r-- | src/battle/src/Struct/Character.elm | 8 | ||||
| -rw-r--r-- | src/battle/src/Struct/MessageBoard.elm | 14 | ||||
| -rw-r--r-- | src/battle/src/Struct/PuppeteerAction.elm | 16 | ||||
| -rw-r--r-- | src/battle/src/Struct/TurnResult.elm | 371 | ||||
| -rw-r--r-- | src/battle/src/View/Character.elm | 8 | ||||
| -rw-r--r-- | src/battle/src/View/Controlled/CharacterCard.elm | 6 | ||||
| -rw-r--r-- | src/battle/src/View/MessageBoard.elm | 28 | ||||
| -rw-r--r-- | src/battle/src/View/MessageBoard/Attack.elm (renamed from src/battle/src/View/MessageBoard/Animator/Attack.elm) | 138 | ||||
| -rw-r--r-- | src/battle/src/View/SubMenu/Timeline/Attack.elm | 4 | ||||
| -rw-r--r-- | src/battle/src/View/SubMenu/Timeline/Movement.elm | 2 | ||||
| -rw-r--r-- | src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm | 2 | 
12 files changed, 123 insertions, 514 deletions
| diff --git a/src/battle/src/Struct/Battle.elm b/src/battle/src/Struct/Battle.elm index 19c3ceb..84d08ba 100644 --- a/src/battle/src/Struct/Battle.elm +++ b/src/battle/src/Struct/Battle.elm @@ -85,14 +85,14 @@ regenerate_attack_of_opportunity_tags_for_char char_ix char battle =     let        tag_name = ("matk_c" ++ (String.fromInt char_ix))        map_without_this_tag = -         (BattleMap.Struct.Map.remove_tag tag_name battle.map) +         (BattleMap.Struct.Map.remove_marker tag_name battle.map)     in        case (Struct.Character.get_melee_attack_range char) of           0 -> {battle | map = map_without_this_tag}           attack_range ->                 {battle |                    map = -                     (BattleMap.Struct.Map.add_tag +                     (BattleMap.Struct.Map.add_marker                          tag_name                          (BattleMap.Struct.Marker.new_melee_attack                             char_ix @@ -140,7 +140,7 @@ add_character s0char battle =           )        characters = battle.characters     in -      (regenerate_attack_of_opportunity_markers_of_char +      (regenerate_attack_of_opportunity_tags_for_char           (Array.length characters)           s1char           {battle | characters = (Array.push s1char characters)} @@ -170,21 +170,27 @@ set_characters chars battle = {battle | characters = chars}  refresh_character : BattleMap.Struct.DataSet.Type -> Int -> Type -> Type  refresh_character map_dataset ix battle = -   let -      character = (get_character ix battle) -      refreshed_character = -         (Struct.Character.refresh_omnimods -            (\loc -> -               (BattleMap.Struct.Map.get_omnimods_at loc map_dataset battle.map) +   case (get_character ix battle) of +      Nothing -> battle +      (Just character) -> +         let +            refreshed_character = +               (Struct.Character.refresh_omnimods +                  (\loc -> +                     (BattleMap.Struct.Map.get_omnimods_at +                        loc +                        map_dataset +                        battle.map +                     ) +                  ) +                  character +               ) +         in +            (regenerate_attack_of_opportunity_tags_for_char +               ix +               refreshed_character +               (set_character ix refreshed_character battle)              ) -            character -         ) -   in -      (regenerate_attack_of_opportunity_tags_for_char -         ix -         refreshed_character -         (set_character ix refreshed_character battle) -      )  -----------------  ---- Players ---- diff --git a/src/battle/src/Struct/Character.elm b/src/battle/src/Struct/Character.elm index 8f452c4..6cdbaab 100644 --- a/src/battle/src/Struct/Character.elm +++ b/src/battle/src/Struct/Character.elm @@ -193,7 +193,7 @@ refresh_omnimods : (        Type ->        Type     ) -refresh_omnimods omnimods_fun character = +refresh_omnimods omnimods_fun char =     let        previous_max_health =           (Battle.Struct.Attributes.get_max_health @@ -259,7 +259,7 @@ remove_extra_display_effect effect_name char =  get_extra_display_effects : Type -> (Set.Set String)  get_extra_display_effects char = char.extra_display_effects -get_extra_display_effects_list : Type -> (Set.Set String) +get_extra_display_effects_list : Type -> (List String)  get_extra_display_effects_list char = (Set.toList char.extra_display_effects)  reset_extra_display_effects : Int -> Type -> Type @@ -273,14 +273,14 @@ reset_extra_display_effects viewer_ix char =                    then "ally"                    else "enemy"                 ), -               ("team-" ++ char.player_ix), +               ("team-" ++ (String.fromInt char.player_ix)),                 (                    if (char.enabled)                    then "enabled"                    else "disabled"                 ),                 ( -                  if (is_alive) +                  if (is_alive char)                    then "alive"                    else "dead"                 ) diff --git a/src/battle/src/Struct/MessageBoard.elm b/src/battle/src/Struct/MessageBoard.elm index 9ddecf0..4c3ad1c 100644 --- a/src/battle/src/Struct/MessageBoard.elm +++ b/src/battle/src/Struct/MessageBoard.elm @@ -26,8 +26,8 @@ type Message =  type alias Type =     { -      secondary_messages = (List Message), -      main_message = (Maybe Message) +      secondary_messages : (List Message), +      main_message : (Maybe Message)     }  -------------------------------------------------------------------------------- @@ -43,20 +43,20 @@ display message board =        (AttackReport _) -> {board | main_message = (Just message)}        _ ->           {board | -            secondary_messages = [message|board.secondary_messages] +            secondary_messages = (message :: board.secondary_messages)           }  try_getting_current_message : Type -> (Maybe Message)  try_getting_current_message board = -   case secondary_messages of +   case board.secondary_messages of        [] -> board.main_message -      [secondary_message|_] -> (Just secondary_message) +      (secondary_message :: _) -> (Just secondary_message)  clear_current_message : Type -> Type  clear_current_message board = -   case secondary_messages of +   case board.secondary_messages of        [] -> {board | main_message = Nothing} -      [_|remaining_secondary_messages] -> +      (_ :: remaining_secondary_messages) ->           {board |              secondary_messages = remaining_secondary_messages           } diff --git a/src/battle/src/Struct/PuppeteerAction.elm b/src/battle/src/Struct/PuppeteerAction.elm index 47a0bcc..c8207b0 100644 --- a/src/battle/src/Struct/PuppeteerAction.elm +++ b/src/battle/src/Struct/PuppeteerAction.elm @@ -11,8 +11,10 @@ import Set  -- Battle Map ------------------------------------------------------------------  import BattleMap.Struct.DataSet +import BattleMap.Struct.Direction  -- Local Module ---------------------------------------------------------------- +import Struct.Attack  import Struct.Battle  import Struct.TurnResult @@ -24,9 +26,9 @@ type Effect =     | AnnounceVictory Int     | Focus Int     | Hit Struct.Attack.Type -   | Move (Int, Battle.Struct.Direction) -   | RefreshCharacter (Boolean, Int) -   | RefreshCharactersOf (Boolean, Int) +   | Move (Int, BattleMap.Struct.Direction.Type) +   | RefreshCharacter (Bool, Int) +   | RefreshCharactersOf (Bool, Int)     | StartTurn Int     | SwapWeapons Int     | Target (Int, Int) @@ -54,7 +56,7 @@ from_attacked attack =           (PerformFor (2.0, [(Focus attacker_ix)])),           (PerformFor (2.0, [(Focus defender_ix)])),           (List.map -            (PerformFor (..., (Hit attack))) +            (PerformFor (5.0, (Hit attack)))           ),           (Perform              [ @@ -70,8 +72,10 @@ from_moved movement =        (           [              (PerformFor (1.0, [(Focus actor_ix)])), -            (Perform [(RefreshCharacter (False, actor_ix))]), -            | +            (Perform [(RefreshCharacter (False, actor_ix))]) +         ] +         ++ +         [              (List.map                 (\dir ->                    (PerformFor diff --git a/src/battle/src/Struct/TurnResult.elm b/src/battle/src/Struct/TurnResult.elm index aaf3dfa..b0d7d09 100644 --- a/src/battle/src/Struct/TurnResult.elm +++ b/src/battle/src/Struct/TurnResult.elm @@ -7,13 +7,6 @@ module Struct.TurnResult exposing        PlayerVictory,        PlayerDefeat,        PlayerTurnStart, -      get_next_movement_dir, -      get_actor_index, -      get_attack_defender_index, -      maybe_get_attack_next_step, -      apply_inverse_step, -      apply_step, -      maybe_remove_step,        decoder     ) @@ -90,218 +83,6 @@ type Type =  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -apply_movement_step : ( -      (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) -> -      Movement -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_movement_step tile_omnimods movement characters players = -   ( -      (Util.Array.update_unsafe -         movement.character_index -         (\char -> -            case (List.head movement.path) of -               (Just dir) -> -                  (Struct.Character.dirty_set_location -                     (BattleMap.Struct.Location.neighbor -                        dir -                        (Struct.Character.get_location char) -                     ) -                     char -                  ) - -               Nothing -> -                  let current_location = (Struct.Character.get_location char) in -                     (Struct.Character.set_location -                        current_location -                        (tile_omnimods current_location) -                        char -                     ) -         ) -         characters -      ), -      players -   ) - -apply_inverse_movement_step : ( -      (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) -> -      Movement -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_inverse_movement_step tile_omnimods movement characters players = -   ( -      (Util.Array.update_unsafe -         movement.character_index -         (\char -> -            ( -               let -                  location = -                     (List.foldr -                        (BattleMap.Struct.Location.neighbor) -                        (Struct.Character.get_location char) -                        --(movement.destination) -                        (List.map -                           (BattleMap.Struct.Direction.opposite_of) -                           movement.path -                        ) -                     ) -               in -                  (Struct.Character.set_location -                     location -                     (tile_omnimods location) -                     char -                  ) -            ) -         ) -         characters -      ), -      players -   ) - -apply_switched_weapon : ( -      WeaponSwitch -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_switched_weapon weapon_switch characters players = -   ( -      (Util.Array.update_unsafe -         weapon_switch.character_index -         (\char -> -            (Struct.Character.set_base_character -               (BattleCharacters.Struct.Character.switch_weapons -                 (Struct.Character.get_base_character char) -               ) -               char -            ) -         ) -         characters -      ), -      players -   ) - -apply_player_defeat : ( -      PlayerDefeat -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_player_defeat pdefeat characters players = -   ( -      (Array.map -         (\c -> -            if ((Struct.Character.get_player_index c) == pdefeat.player_index) -            then (Struct.Character.set_defeated True c) -            else c -         ) -         characters -      ), -      players -   ) - -apply_inverse_player_defeat : ( -      PlayerDefeat -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_inverse_player_defeat pdefeat characters players = -   ( -      (Array.map -         (\c -> -            ( -               if -               ( -                  (Struct.Character.get_player_index c) -                  == pdefeat.player_index -               ) -               then (Struct.Character.set_defeated False c) -               else c -            ) -         ) -         characters -      ), -      players -   ) - -apply_attack_step : ( -      Attack -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_attack_step attack characters players = -   case (List.head attack.sequence) of -      (Just attack_step) -> -         ( -            (Struct.Attack.apply_to_characters -               attack.attacker_index -               attack.defender_index -               attack_step -               characters -            ), -            players -         ) - -      Nothing -> -         ( -            characters, -            (Util.Array.update_unsafe -               attack.attacker_index -               (Struct.Player.set_luck attack.attacker_luck) -               (Util.Array.update_unsafe -                  attack.defender_index -                  (Struct.Player.set_luck attack.defender_luck) -                  players -               ) -            ) -         ) - -apply_inverse_attack : ( -      Attack -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_inverse_attack attack characters players = -   ( -      (List.foldr -         (Struct.Attack.apply_inverse_to_characters -            attack.attacker_index -            attack.defender_index -         ) -         characters -         attack.sequence -      ), -      players -   ) -  movement_decoder : (Json.Decode.Decoder Movement)  movement_decoder =     (Json.Decode.map3 @@ -397,162 +178,10 @@ internal_decoder kind =                 ++ "\"."              )           ) - -maybe_remove_movement_step : Movement -> (Maybe Type) -maybe_remove_movement_step movement = -   case (List.tail movement.path) of -      Nothing -> Nothing -      (Just path_tail) -> -         (Just -            (Moved -               {movement | -                  path = path_tail -               } -            ) -         ) - -maybe_remove_attack_step : Attack -> (Maybe Type) -maybe_remove_attack_step attack = -   case (List.tail attack.sequence) of -      Nothing -> Nothing -      (Just sequence_tail) -> -         (Just -            (Attacked -               {attack | -                  sequence = sequence_tail -               } -            ) -         ) - -apply_player_victory : ( -      PlayerVictory -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_player_victory player_victory characters players = -   ( -      characters, -      players -   ) - -apply_player_turn_started : ( -      PlayerTurnStart -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_player_turn_started player_defeat characters players = -   ( -      characters, -      players -   ) -  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- -apply_step : ( -      (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) -> -      Type -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_step tile_omnimods turn_result characters players = -   case turn_result of -      (Moved movement) -> -         (apply_movement_step (tile_omnimods) movement characters players) - -      (SwitchedWeapon weapon_switch) -> -         (apply_switched_weapon weapon_switch characters players) - -      (Attacked attack) -> -         (apply_attack_step attack characters players) - -      (PlayerWon pvict) -> -         (apply_player_victory pvict characters players) - -      (PlayerLost pdefeat) -> -         (apply_player_defeat pdefeat characters players) - -      (PlayerTurnStarted pturns) -> -         (apply_player_turn_started pturns characters players) - -apply_inverse_step : ( -      (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) -> -      Type -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Player.Type) -> -      ( -         (Array.Array Struct.Character.Type), -         (Array.Array Struct.Player.Type) -      ) -   ) -apply_inverse_step tile_omnimods turn_result characters players = -   case turn_result of -      (Moved movement) -> -         (apply_inverse_movement_step -            (tile_omnimods) -            movement -            characters -            players -         ) - -      (SwitchedWeapon weapon_switch) -> -         (apply_switched_weapon weapon_switch characters players) - -      (Attacked attack) -> -         (apply_inverse_attack attack characters players) - -      (PlayerWon pvict) -> (characters, players) - -      (PlayerLost pdefeat) -> -         (apply_inverse_player_defeat pdefeat characters players) - -      (PlayerTurnStarted pturns) -> (characters, players) -  decoder : (Json.Decode.Decoder Type)  decoder =     (Json.Decode.field "t" Json.Decode.string)     |> (Json.Decode.andThen internal_decoder) - -maybe_remove_step : Type -> (Maybe Type) -maybe_remove_step turn_result = -   case turn_result of -      (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 -> BattleMap.Struct.Direction.Type -get_next_movement_dir movement = -   case (List.head movement.path) of -      (Just dir) -> dir -      Nothing -> BattleMap.Struct.Direction.None - -get_attack_defender_index : Attack -> Int -get_attack_defender_index attack = attack.defender_index - -maybe_get_attack_next_step : Attack -> (Maybe Struct.Attack.Type) -maybe_get_attack_next_step attack = (List.head attack.sequence) - -get_actor_index : Type -> Int -get_actor_index turn_result = -   case turn_result of -      (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/battle/src/View/Character.elm b/src/battle/src/View/Character.elm index 3a3f820..dac5989 100644 --- a/src/battle/src/View/Character.elm +++ b/src/battle/src/View/Character.elm @@ -6,6 +6,8 @@ import Html.Attributes  import Html.Events  -- Battle Characters ----------------------------------------------------------- +import BattleCharacters.Struct.Character +  import BattleCharacters.View.Portrait  -- Local Module ---------------------------------------------------------------- @@ -22,11 +24,11 @@ import Struct.Event  get_portrait_html : Struct.Character.Type -> (Html.Html Struct.Event.Type)  get_portrait_html char =     (BattleCharacters.View.Portrait.get_html -      [ +      (           (Html.Events.onClick              (Struct.Event.LookingForCharacter (Struct.Character.get_index char))           ) -         | +         ::           (List.map              (                 \effect_name -> @@ -36,7 +38,7 @@ get_portrait_html char =              )              (Struct.Character.get_extra_display_effects_list char)           ) -      ] +      )        (BattleCharacters.Struct.Character.get_equipment           (Struct.Character.get_base_character char)        ) diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm index 291263c..0d7eda1 100644 --- a/src/battle/src/View/Controlled/CharacterCard.elm +++ b/src/battle/src/View/Controlled/CharacterCard.elm @@ -352,7 +352,7 @@ get_minimal_html player_ix char =                       (Html.Attributes.class "info-card-picture")                    ]                    [ -                     (View.Character.get_portrait_html player_ix char) +                     (View.Character.get_portrait_html char)                    ]                 ),                 (get_health_bar char), @@ -400,7 +400,7 @@ get_summary_html char_turn player_ix char =                          (Html.Attributes.class "info-card-picture")                       ]                       [ -                        (View.Character.get_portrait_html player_ix char) +                        (View.Character.get_portrait_html char)                       ]                    ),                    (get_health_bar char), @@ -456,7 +456,7 @@ get_full_html player_ix char =                          (Html.Attributes.class "info-card-picture")                       ]                       [ -                        (View.Character.get_portrait_html player_ix char) +                        (View.Character.get_portrait_html char)                       ]                    ),                    (get_health_bar char), diff --git a/src/battle/src/View/MessageBoard.elm b/src/battle/src/View/MessageBoard.elm index 9b31f65..8a47b40 100644 --- a/src/battle/src/View/MessageBoard.elm +++ b/src/battle/src/View/MessageBoard.elm @@ -3,28 +3,38 @@ module View.MessageBoard exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Html +-- Shared ---------------------------------------------------------------------- +import Util.Html +  -- Local Module ----------------------------------------------------------------  import Struct.Event  import Struct.Model +import Struct.MessageBoard -import View.MessageBoard.Animator +import View.MessageBoard.Attack  import View.MessageBoard.Error  import View.MessageBoard.Help  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- +display : ( +      Struct.Model.Type -> +      Struct.MessageBoard.Message -> +      (Html.Html Struct.Event.Type) +   ) +display model message = +   case message of +      (Error error_msg) -> (View.MessageBoard.Error.get_html model error_msg) +      (AttackReport attack) -> (View.MessageBoard.Attack.get_html model attack) +      (Help help_request) -> +         (View.MessageBoard.Help.get_html model help_request)  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)  get_html model = -   case (model.error) of -      (Just error) -> (View.MessageBoard.Error.get_html model error) -      Nothing -> -         case model.animator of -            (Just animator) -> -               (View.MessageBoard.Animator.get_html model.battle animator) - -            Nothing -> (View.MessageBoard.Help.get_html model) +   case (Struct.MessageBoard.try_getting_current_message model.message_board) of +      Nothing -> (Util.Html.nothing) +      (Just message) -> (display model message) diff --git a/src/battle/src/View/MessageBoard/Animator/Attack.elm b/src/battle/src/View/MessageBoard/Attack.elm index 6b79903..041b3e3 100644 --- a/src/battle/src/View/MessageBoard/Animator/Attack.elm +++ b/src/battle/src/View/MessageBoard/Attack.elm @@ -1,4 +1,4 @@ -module View.MessageBoard.Animator.Attack exposing (get_html) +module View.MessageBoard.Attack exposing (get_html)  -- Elm -------------------------------------------------------------------------  import Array @@ -14,6 +14,7 @@ import Struct.Attack  import Struct.Battle  import Struct.Character  import Struct.Event +import Struct.Model  import View.Controlled.CharacterCard @@ -145,45 +146,30 @@ get_defense_animation_class attack char =        else "animated-portrait-dies"  get_attacker_card : ( -      (Maybe Struct.Attack.Type) -> +      Struct.Attack.Type ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_attacker_card maybe_attack char = +get_attacker_card attack char =     (Html.div -      (case maybe_attack of -         Nothing -> -            if ((Struct.Character.get_current_health char) > 0) -            then -               [ -                  (Html.Attributes.class "animated-portrait") -               ] -            else -               [ -                  (Html.Attributes.class "animated-portrait-absent"), -                  (Html.Attributes.class "animated-portrait") -               ] - -         (Just attack) -> -            [ -               (Html.Attributes.class -                  (case (attack.order, attack.parried) of -                     (Struct.Attack.Counter, True) -> -                        (get_attack_animation_class attack char) +      [ +         (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) +               (Struct.Attack.Counter, _) -> +                  (get_defense_animation_class attack char) -                     (_, True) -> -                        (get_defense_animation_class attack char) +               (_, True) -> +                  (get_defense_animation_class attack char) -                     (_, _) -> -                        (get_attack_animation_class attack char) -                  ) -               ), -               (Html.Attributes.class "animated-portrait") -            ] -      ) +               (_, _) -> +                  (get_attack_animation_class attack char) +            ) +         ), +         (Html.Attributes.class "animated-portrait") +      ]        [           (View.Controlled.CharacterCard.get_minimal_html              (Struct.Character.get_player_index char) @@ -193,61 +179,43 @@ get_attacker_card maybe_attack char =     )  get_defender_card : ( -      (Maybe Struct.Attack.Type) -> +      Struct.Attack.Type ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_defender_card maybe_attack char = +get_defender_card attack char =     (Html.div -      (case maybe_attack of -         Nothing -> -            if ((Struct.Character.get_current_health char) > 0) -            then -               [ -                  (Html.Attributes.class "animated-portrait") -               ] -            else -               [ -                  (Html.Attributes.class "animated-portrait-absent"), -                  (Html.Attributes.class "animated-portrait") -               ] - -         (Just attack) -> -            [ -               (Html.Attributes.class -                  (case (attack.order, attack.parried) of -                     (Struct.Attack.Counter, True) -> -                        (get_defense_animation_class attack char) +      [ +         (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) +               (Struct.Attack.Counter, _) -> +                  (get_attack_animation_class attack char) -                     (_, True) -> -                        (get_attack_animation_class attack char) +               (_, True) -> +                  (get_attack_animation_class attack char) -                     (_, _) -> -                        (get_defense_animation_class attack char) -                  ) -               ), -               (Html.Attributes.class "animated-portrait") -            ] -      ) +               (_, _) -> +                  (get_defense_animation_class attack char) +            ) +         ), +         (Html.Attributes.class "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) -> +      Struct.Attack.Type ->        (Html.Html Struct.Event.Type)     ) -get_placeholder_html characters attacker_ix defender_ix maybe_attack = +get_placeholder_html characters attacker_ix defender_ix attack =     case        (           (Array.get attacker_ix characters), @@ -262,16 +230,9 @@ get_placeholder_html characters attacker_ix defender_ix maybe_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) +                  (get_attacker_card attack atkchar), +                  (get_attack_html atkchar defchar attack), +                  (get_defender_card attack defchar)                 ]              )           ) @@ -284,21 +245,18 @@ get_placeholder_html characters attacker_ix defender_ix maybe_attack =                 (Html.text "Error: Attack with unknown characters")              ]           ) -  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_html : ( -      Struct.Battle.Type -> -      Int -> -      Int -> -      (Maybe Struct.Attack.Type) -> +      Struct.Model.Type -> +      Struct.Attack.Type ->        (Html.Html Struct.Event.Type)     ) -get_html battle attacker_ix defender_ix maybe_attack = +get_html model attack =     (get_placeholder_html -      (Struct.Battle.get_characters battle) -      attacker_ix -      defender_ix -      maybe_attack +      (Struct.Battle.get_characters model.battle) +      0 -- TODO: get attacker IX +      0 -- TODO: get defender IX +      attack     ) diff --git a/src/battle/src/View/SubMenu/Timeline/Attack.elm b/src/battle/src/View/SubMenu/Timeline/Attack.elm index 7301126..fe43b6a 100644 --- a/src/battle/src/View/SubMenu/Timeline/Attack.elm +++ b/src/battle/src/View/SubMenu/Timeline/Attack.elm @@ -153,8 +153,8 @@ get_html characters player_ix attack =              ]              (                 [ -                  (View.Character.get_portrait_html player_ix atkchar), -                  (View.Character.get_portrait_html player_ix defchar), +                  (View.Character.get_portrait_html atkchar), +                  (View.Character.get_portrait_html defchar),                    (get_title_html atkchar defchar)                 ]                 ++ diff --git a/src/battle/src/View/SubMenu/Timeline/Movement.elm b/src/battle/src/View/SubMenu/Timeline/Movement.elm index 3ef305e..4d748be 100644 --- a/src/battle/src/View/SubMenu/Timeline/Movement.elm +++ b/src/battle/src/View/SubMenu/Timeline/Movement.elm @@ -38,7 +38,7 @@ get_html characters player_ix movement =                 (Html.Attributes.class "timeline-movement")              ]              [ -               (View.Character.get_portrait_html player_ix char), +               (View.Character.get_portrait_html char),                 (Html.text                    (                       (BattleCharacters.Struct.Character.get_name diff --git a/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm index 50fd702..f547df8 100644 --- a/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm +++ b/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm @@ -38,7 +38,7 @@ get_html characters player_ix weapon_switch =                 (Html.Attributes.class "timeline-weapon-switch")              ]              [ -               (View.Character.get_portrait_html player_ix char), +               (View.Character.get_portrait_html char),                 (Html.text                    (                       (BattleCharacters.Struct.Character.get_name | 


