| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/battle')
| -rw-r--r-- | src/battle/src/Struct/Attack.elm | 57 | ||||
| -rw-r--r-- | src/battle/src/Struct/MessageBoard.elm | 4 | ||||
| -rw-r--r-- | src/battle/src/Struct/PuppeteerAction.elm | 63 | ||||
| -rw-r--r-- | src/battle/src/Struct/TurnResult.elm | 43 | ||||
| -rw-r--r-- | src/battle/src/Update/Puppeteer/Hit.elm | 95 | ||||
| -rw-r--r-- | src/battle/src/View/MessageBoard/Animator.elm | 58 | ||||
| -rw-r--r-- | src/battle/src/View/MessageBoard/Attack.elm | 184 | ||||
| -rw-r--r-- | src/battle/src/View/SubMenu/Timeline/Attack.elm | 25 | 
8 files changed, 211 insertions, 318 deletions
| diff --git a/src/battle/src/Struct/Attack.elm b/src/battle/src/Struct/Attack.elm index 527ff2d..ee89427 100644 --- a/src/battle/src/Struct/Attack.elm +++ b/src/battle/src/Struct/Attack.elm @@ -4,13 +4,22 @@ module Struct.Attack exposing        Order(..),        Precision(..),        decoder, -      get_order +      get_actor_index, +      get_damage, +      get_is_a_parry, +      get_is_a_critical, +      get_new_actor_luck, +      get_new_target_luck, +      get_order, +      get_precision, +      get_target_index     )  -- Elm -------------------------------------------------------------------------  import Array  import Json.Decode +import Json.Decode.Pipeline  -- Local Module ----------------------------------------------------------------  import Struct.Character @@ -30,11 +39,15 @@ type Precision =  type alias Type =     { +      attacker_index : Int, +      defender_index : Int,        order : Order,        precision : Precision,        critical : Bool,        parried : Bool, -      damage : Int +      damage : Int, +      attacker_luck : Int, +      defender_luck : Int     }  -------------------------------------------------------------------------------- @@ -67,13 +80,41 @@ precision_decoder =  get_order : Type -> Order  get_order at = at.order +get_is_a_parry : Type -> Bool +get_is_a_parry at = at.parried + +get_is_a_critical : Type -> Bool +get_is_a_critical at = at.critical + +get_precision : Type -> Precision +get_precision at = at.precision + +get_damage : Type -> Int +get_damage at = at.damage + +get_actor_index : Type -> Int +get_actor_index at = at.attacker_index + +get_target_index : Type -> Int +get_target_index at = at.defender_index + +get_new_actor_luck : Type -> Int +get_new_actor_luck at = at.attacker_luck + +get_new_target_luck : Type -> Int +get_new_target_luck at = at.defender_luck +  decoder : (Json.Decode.Decoder Type)  decoder = -   (Json.Decode.map5 +   (Json.Decode.succeed        Type -      (Json.Decode.field "ord" (order_decoder)) -      (Json.Decode.field "pre" (precision_decoder)) -      (Json.Decode.field "cri" (Json.Decode.bool)) -      (Json.Decode.field "par" (Json.Decode.bool)) -      (Json.Decode.field "dmg" (Json.Decode.int)) +      |> (Json.Decode.Pipeline.required "aix" Json.Decode.int) +      |> (Json.Decode.Pipeline.required "dix" Json.Decode.int) +      |> (Json.Decode.Pipeline.required "ord" (order_decoder)) +      |> (Json.Decode.Pipeline.required "pre" (precision_decoder)) +      |> (Json.Decode.Pipeline.required "cri" (Json.Decode.bool)) +      |> (Json.Decode.Pipeline.required "par" (Json.Decode.bool)) +      |> (Json.Decode.Pipeline.required "dmg" (Json.Decode.int)) +      |> (Json.Decode.Pipeline.required "alk" Json.Decode.int) +      |> (Json.Decode.Pipeline.required "dlk" Json.Decode.int)     ) diff --git a/src/battle/src/Struct/MessageBoard.elm b/src/battle/src/Struct/MessageBoard.elm index aa34573..616a8a4 100644 --- a/src/battle/src/Struct/MessageBoard.elm +++ b/src/battle/src/Struct/MessageBoard.elm @@ -13,9 +13,9 @@ module Struct.MessageBoard exposing  -- Elm -------------------------------------------------------------------------  -- Local Module ---------------------------------------------------------------- +import Struct.Attack  import Struct.Error  import Struct.HelpRequest -import Struct.TurnResult  --------------------------------------------------------------------------------  -- TYPES ----------------------------------------------------------------------- @@ -23,7 +23,7 @@ import Struct.TurnResult  type Message =     Help Struct.HelpRequest.Type     | Error Struct.Error.Type -   | AttackReport Struct.TurnResult.Attack +   | AttackReport Struct.Attack.Type  type alias Type =     { diff --git a/src/battle/src/Struct/PuppeteerAction.elm b/src/battle/src/Struct/PuppeteerAction.elm index 8543dca..71a98f7 100644 --- a/src/battle/src/Struct/PuppeteerAction.elm +++ b/src/battle/src/Struct/PuppeteerAction.elm @@ -30,7 +30,7 @@ type Effect =     | Focus Int     | DisplayMessage Struct.MessageBoard.Message     | ClearMessage Struct.MessageBoard.Message -   | Hit Struct.TurnResult.Attack +   | Hit Struct.Attack.Type     | Move (Int, BattleMap.Struct.Direction.Type)     | RefreshCharacter (Bool, Int)     | RefreshCharactersOf (Bool, Int) @@ -48,56 +48,53 @@ type Type =  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -from_attacked : Struct.TurnResult.Attack -> (List Type) +from_attacked : Struct.Attack.Type -> (List Type)  from_attacked attack =     let -      attacker_ix = (Struct.TurnResult.get_attack_actor_index attack) -      defender_ix = (Struct.TurnResult.get_attack_target_index attack) +      attacker_ix = (Struct.Attack.get_actor_index attack) +      defender_ix = (Struct.Attack.get_target_index attack)     in        (           [ -            (Perform -               [ -                  (RefreshCharacter (False, attacker_ix)), -                  (RefreshCharacter (False, defender_ix)), -                  (ToggleCharacterEffect -                     ( -                        defender_ix, -                        Constants.DisplayEffects.attack_target -                     ) -                  ), -                  (DisplayCharacterNavigator attacker_ix), -                  (DisplayMessage (Struct.MessageBoard.AttackReport attack)) -               ] -            ),              (PerformFor                 (                    1.5,                    [ +                     (RefreshCharacter (False, attacker_ix)), +                     (RefreshCharacter (False, defender_ix)), +                     (ToggleCharacterEffect +                        ( +                           defender_ix, +                           Constants.DisplayEffects.attack_target +                        ) +                     ), +                     (DisplayCharacterNavigator attacker_ix), +                     (DisplayMessage (Struct.MessageBoard.AttackReport attack))                    ]                 )              ), -            (Perform [ (Hit attack) ]), +            (PerformFor +               ( +                  5.0, +                  [ (Hit attack) ] +               ) +            ),              (PerformFor                 (                    1.5,                    [ +                     (ClearMessage (Struct.MessageBoard.AttackReport attack)), +                     (RefreshCharacter (True, attacker_ix)), +                     (RefreshCharacter (True, defender_ix)), +                     (ToggleCharacterEffect +                        ( +                           defender_ix, +                           Constants.DisplayEffects.attack_target +                        ) +                     ), +                     (ClearCharacterNavigator attacker_ix)                    ]                 ) -            ), -            (Perform -               [ -                  (ClearMessage (Struct.MessageBoard.AttackReport attack)), -                  (RefreshCharacter (True, attacker_ix)), -                  (RefreshCharacter (True, defender_ix)), -                  (ToggleCharacterEffect -                     ( -                        defender_ix, -                        Constants.DisplayEffects.attack_target -                     ) -                  ), -                  (ClearCharacterNavigator attacker_ix) -               ]              )           ]        ) diff --git a/src/battle/src/Struct/TurnResult.elm b/src/battle/src/Struct/TurnResult.elm index ef70082..d3d618d 100644 --- a/src/battle/src/Struct/TurnResult.elm +++ b/src/battle/src/Struct/TurnResult.elm @@ -1,7 +1,6 @@  module Struct.TurnResult exposing     (        Type(..), -      Attack,        Target,        Movement,        WeaponSwitch, @@ -14,9 +13,6 @@ module Struct.TurnResult exposing        get_weapon_switch_actor_index,        get_movement_actor_index,        get_movement_path, -      get_attack_actor_index, -      get_attack_target_index, -      get_attack_data,        get_target_actor_index,        get_target_target_index,        decoder @@ -61,15 +57,6 @@ type alias Target =        target_index : Int     } -type alias Attack = -   { -      attacker_index : Int, -      defender_index : Int, -      data : Struct.Attack.Type, -      attacker_luck : Int, -      defender_luck : Int -   } -  type alias WeaponSwitch =     {        character_index : Int @@ -93,7 +80,7 @@ type alias PlayerTurnStart =  type Type =     Moved Movement     | Targeted Target -   | Attacked Attack +   | Attacked Struct.Attack.Type     | SwitchedWeapon WeaponSwitch     | PlayerWon PlayerVictory     | PlayerLost PlayerDefeat @@ -119,23 +106,6 @@ target_decoder =        (Json.Decode.field "dix" Json.Decode.int)     ) -attack_decoder : (Json.Decode.Decoder Attack) -attack_decoder = -   (Json.Decode.andThen -      ( -         \attack -> -            (Json.Decode.map5 -               Attack -               (Json.Decode.field "aix" Json.Decode.int) -               (Json.Decode.field "dix" Json.Decode.int) -               (Json.Decode.succeed attack) -               (Json.Decode.field "alk" Json.Decode.int) -               (Json.Decode.field "dlk" Json.Decode.int) -            ) -      ) -      (Struct.Attack.decoder) -   ) -  weapon_switch_decoder : (Json.Decode.Decoder WeaponSwitch)  weapon_switch_decoder =     (Json.Decode.map @@ -182,7 +152,7 @@ internal_decoder kind =        "atk" ->           (Json.Decode.map              (\x -> (Attacked x)) -            (attack_decoder) +            (Struct.Attack.decoder)           )        "tar" -> @@ -243,15 +213,6 @@ get_movement_actor_index movement = movement.character_index  get_movement_path : Movement -> (List BattleMap.Struct.Direction.Type)  get_movement_path movement = movement.path -get_attack_actor_index : Attack -> Int -get_attack_actor_index attack = attack.attacker_index - -get_attack_target_index : Attack -> Int -get_attack_target_index attack = attack.defender_index - -get_attack_data : Attack -> Struct.Attack.Type -get_attack_data attack = attack.data -  get_target_actor_index : Target -> Int  get_target_actor_index target = target.actor_index diff --git a/src/battle/src/Update/Puppeteer/Hit.elm b/src/battle/src/Update/Puppeteer/Hit.elm index 3b95e3e..4addab1 100644 --- a/src/battle/src/Update/Puppeteer/Hit.elm +++ b/src/battle/src/Update/Puppeteer/Hit.elm @@ -1,12 +1,10 @@  module Update.Puppeteer.Hit exposing (forward, backward)  -- Elm ------------------------------------------------------------------------- -import Array  -- Local Module ----------------------------------------------------------------  import Struct.Attack  import Struct.Battle -import Struct.TurnResult  import Struct.Character  import Struct.Event  import Struct.Model @@ -14,93 +12,52 @@ import Struct.Model  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -apply_damage_to_character : ( -      Int -> -      Struct.Character.Type -> -      Struct.Character.Type -   ) -apply_damage_to_character damage char = -   (Struct.Character.set_current_health -      ((Struct.Character.get_current_health char) - damage) -      char -   ) - -apply_to_characters : ( -      Int -> -      Struct.Attack.Type -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Character.Type) -   ) -apply_to_characters defender_ix attack characters = -   case (Array.get defender_ix characters) of -      (Just char) -> -         (Array.set -            defender_ix -            (apply_damage_to_character attack.damage char) -            characters -         ) - -      Nothing -> characters - -apply_inverse_to_characters : ( -      Int -> -      Struct.Attack.Type -> -      (Array.Array Struct.Character.Type) -> -      (Array.Array Struct.Character.Type) -   ) -apply_inverse_to_characters defender_ix attack characters = -   case (Array.get defender_ix characters) of -      (Just char) -> -         (Array.set -            defender_ix -            (apply_damage_to_character (-1 * attack.damage) char) -            characters +apply_damage_to_character : Int -> Int -> Struct.Model.Type -> Struct.Model.Type +apply_damage_to_character damage char_ix model = +   {model | +      battle = +         (Struct.Battle.update_character +            char_ix +            (\char -> +               (Struct.Character.set_current_health +                  ((Struct.Character.get_current_health char) - damage) +                  char +               ) +            ) +            model.battle           ) - -      Nothing -> characters +   }  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  forward : ( -      Struct.TurnResult.Attack -> +      Struct.Attack.Type ->        Struct.Model.Type ->        (Struct.Model.Type, (List (Cmd Struct.Event.Type)))     )  forward attack model =     ( -      {model | -         battle = -            (Struct.Battle.set_characters -               (apply_to_characters -                  (Struct.TurnResult.get_attack_target_index attack) -                  (Struct.TurnResult.get_attack_data attack) -                  (Struct.Battle.get_characters model.battle) -               ) -               model.battle -            ) -      }, +      (apply_damage_to_character +         (Struct.Attack.get_damage attack) +         (Struct.Attack.get_target_index attack) +         model +      ),        []     )  backward : ( -      Struct.TurnResult.Attack -> +      Struct.Attack.Type ->        Struct.Model.Type ->        (Struct.Model.Type, (List (Cmd Struct.Event.Type)))     )  backward attack model =     ( -      {model | -         battle = -            (Struct.Battle.set_characters -               (apply_inverse_to_characters -                  (Struct.TurnResult.get_attack_target_index attack) -                  (Struct.TurnResult.get_attack_data attack) -                  (Struct.Battle.get_characters model.battle) -               ) -               model.battle -            ) -      }, +      (apply_damage_to_character +         ((Struct.Attack.get_damage attack) * -1) +         (Struct.Attack.get_target_index attack) +         model +      ),        []     ) diff --git a/src/battle/src/View/MessageBoard/Animator.elm b/src/battle/src/View/MessageBoard/Animator.elm deleted file mode 100644 index 99ff190..0000000 --- a/src/battle/src/View/MessageBoard/Animator.elm +++ /dev/null @@ -1,58 +0,0 @@ -module View.MessageBoard.Animator exposing (get_html) - --- Elm ------------------------------------------------------------------------- -import Html - --- Shared ---------------------------------------------------------------------- -import Util.Html - --- Local Module ---------------------------------------------------------------- -import Struct.Battle -import Struct.Event -import Struct.TurnResult -import Struct.TurnResultAnimator - -import View.MessageBoard.Animator.Attack - --------------------------------------------------------------------------------- --- LOCAL ----------------------------------------------------------------------- --------------------------------------------------------------------------------- -get_turn_result_html : ( -      Struct.Battle.Type -> -      Struct.TurnResult.Type -> -      (Html.Html Struct.Event.Type) -   ) -get_turn_result_html battle turn_result = -   case turn_result of -      (Struct.TurnResult.Attacked attack) -> -         (View.MessageBoard.Animator.Attack.get_html -            battle -            (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.Battle.Type -> -      Struct.TurnResultAnimator.Type -> -      (Html.Html Struct.Event.Type) -   ) -get_html battle animator = -   case (Struct.TurnResultAnimator.get_current_animation animator) of -      (Struct.TurnResultAnimator.TurnResult turn_result) -> -         (get_turn_result_html battle turn_result) - -      (Struct.TurnResultAnimator.AttackSetup (attacker_id, defender_id)) -> -         (View.MessageBoard.Animator.Attack.get_html -            battle -            attacker_id -            defender_id -            Nothing -         ) - -      _ -> (Util.Html.nothing) diff --git a/src/battle/src/View/MessageBoard/Attack.elm b/src/battle/src/View/MessageBoard/Attack.elm index 3d2281f..1445c21 100644 --- a/src/battle/src/View/MessageBoard/Attack.elm +++ b/src/battle/src/View/MessageBoard/Attack.elm @@ -15,7 +15,6 @@ import Struct.Battle  import Struct.Character  import Struct.Event  import Struct.Model -import Struct.TurnResult  import View.Controlled.CharacterCard @@ -24,24 +23,25 @@ import View.Controlled.CharacterCard  --------------------------------------------------------------------------------  get_effect_text : Struct.Attack.Type -> String  get_effect_text attack = +   let precision = (Struct.Attack.get_precision attack) in     (        ( -         case attack.precision of +         case precision of              Struct.Attack.Hit -> " hit for "              Struct.Attack.Graze -> " grazed for "              Struct.Attack.Miss -> " missed."        )        ++        ( -         if (attack.precision == Struct.Attack.Miss) +         if (precision == Struct.Attack.Miss)           then              ""           else              ( -               ((String.fromInt attack.damage) ++ " damage") +               ((String.fromInt (Struct.Attack.get_damage attack)) ++ " damage")                 ++                 ( -                  if (attack.critical) +                  if (Struct.Attack.get_is_a_critical attack)                    then " (Critical Hit)."                    else "."                 ) @@ -82,7 +82,12 @@ get_attack_html attacker defender attack =           [              (Html.text                 ( -                  case (attack.order, attack.parried) of +                  case +                     ( +                        (Struct.Attack.get_order attack), +                        (Struct.Attack.get_is_a_parry attack) +                     ) +                  of                       (Struct.Attack.Counter, True) ->                          (                             defender_name @@ -121,7 +126,7 @@ get_attack_animation_class : (        String     )  get_attack_animation_class attack char = -   if (attack.critical) +   if (Struct.Attack.get_is_a_critical attack)     then "animated-portrait-attack-critical"     else "animated-portrait-attacks" @@ -131,147 +136,132 @@ get_defense_animation_class : (        String     )  get_defense_animation_class attack char = -   if (attack.damage == 0) +   if ((Struct.Attack.get_damage attack) == 0)     then -      if (attack.precision == Struct.Attack.Miss) +      if ((Struct.Attack.get_precision attack) == Struct.Attack.Miss)        then "animated-portrait-dodges"        else "animated-portrait-undamaged"     else if ((Struct.Character.get_current_health char) > 0)     then -      if (attack.precision == Struct.Attack.Graze) +      if ((Struct.Attack.get_precision attack) == Struct.Attack.Graze)        then "animated-portrait-grazed-damage"        else "animated-portrait-damaged"     else -      if (attack.precision == Struct.Attack.Graze) +      if ((Struct.Attack.get_precision attack) == Struct.Attack.Graze)        then "animated-portrait-grazed-death"        else "animated-portrait-dies"  get_attacker_card : ( +      Bool ->        Struct.Attack.Type ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_attacker_card attack char = +get_attacker_card keep_positions attack char =     (Html.div -      ( -         (Html.Attributes.class "animated-portrait") -         :: -         ( -            if ((attack.order == Struct.Attack.Counter) == attack.parried) -            then -               [ -                  (Html.Attributes.class -                     (get_attack_animation_class attack char) -                  ), -                  (Html.Attributes.class "initial-attacker") -               ] -            else -               [ -                  (Html.Attributes.class -                     (get_defense_animation_class attack char) -                  ), -                  (Html.Attributes.class "initial-target") -               ] +      [ +         (Html.Attributes.class "animated-portrait"), +         (Html.Attributes.class (get_attack_animation_class attack char)), +         (Html.Attributes.class +            ( +               if (keep_positions) +               then "initial-attacker" +               else "initial-target" +            )           ) -      ) +      ]        [           (View.Controlled.CharacterCard.get_minimal_html -            (Struct.Character.get_player_index char) +            -1              char           )        ]     )  get_defender_card : ( +      Bool ->        Struct.Attack.Type ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_defender_card attack char = +get_defender_card keep_positions attack char =     (Html.div -      ( -         (Html.Attributes.class "animated-portrait") -         :: -         ( -            if ((attack.order == Struct.Attack.Counter) == attack.parried) -            then -               [ -                  (Html.Attributes.class -                     (get_defense_animation_class attack char) -                  ), -                  (Html.Attributes.class "initial-target") -               ] -            else -               [ -                  (Html.Attributes.class -                     (get_attack_animation_class attack char) -                  ), -                  (Html.Attributes.class "initial-attacker") -               ] +      [ +         (Html.Attributes.class "animated-portrait"), +         (Html.Attributes.class (get_defense_animation_class attack char)), +         (Html.Attributes.class +            ( +               if (keep_positions) +               then "initial-target" +               else "initial-attacker" +            )           ) -      ) +      ]        [           (View.Controlled.CharacterCard.get_minimal_html -1 char)        ]     )  get_placeholder_html : ( -      (Array.Array Struct.Character.Type) -> -      Int -> -      Int ->        Struct.Attack.Type -> +      (Array.Array Struct.Character.Type) ->        (Html.Html Struct.Event.Type)     ) -get_placeholder_html characters attacker_ix defender_ix attack = -   case -      ( -         (Array.get attacker_ix characters), -         (Array.get defender_ix characters) -      ) -   of -      ((Just atkchar), (Just defchar)) -> -         (Html.div -            [ -               (Html.Attributes.class "message-board"), -               (Html.Attributes.class "message-attack") -            ] -            ( -               if ((attack.order == Struct.Attack.Counter) == attack.parried) -               then -                  [ -                     (get_attacker_card attack atkchar), -                     (get_attack_html atkchar defchar attack), -                     (get_defender_card attack defchar) -                  ] -               else -                  [ -                     (get_defender_card attack defchar), -                     (get_attack_html atkchar defchar attack), -                     (get_attacker_card attack atkchar) -                  ] -            ) +get_placeholder_html attack characters = +   let +      keep_positions = +         ( +            ((Struct.Attack.get_order attack) == Struct.Attack.Counter) +            == (Struct.Attack.get_is_a_parry attack)           ) - -      _ -> -         (Html.div -            [ -            ] -            [ -               (Html.text "Error: Attack with unknown characters") -            ] +   in +      case +         ( +            (Array.get (Struct.Attack.get_actor_index attack) characters), +            (Array.get (Struct.Attack.get_target_index attack) characters)           ) +      of +         ((Just atkchar), (Just defchar)) -> +            (Html.div +               [ +                  (Html.Attributes.class "message-board"), +                  (Html.Attributes.class "message-attack") +               ] +               ( +                  if (keep_positions) +                  then +                     [ +                        (get_attacker_card keep_positions attack atkchar), +                        (get_attack_html atkchar defchar attack), +                        (get_defender_card keep_positions attack defchar) +                     ] +                  else +                     [ +                        (get_defender_card keep_positions attack defchar), +                        (get_attack_html atkchar defchar attack), +                        (get_attacker_card keep_positions attack atkchar) +                     ] +               ) +            ) + +         _ -> +            (Html.div +               [ +               ] +               [ +                  (Html.text "Error: Attack with unknown characters") +               ] +            )  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_html : (        Struct.Model.Type -> -      Struct.TurnResult.Attack -> +      Struct.Attack.Type ->        (Html.Html Struct.Event.Type)     )  get_html model attack =     (get_placeholder_html +      attack        (Struct.Battle.get_characters model.battle) -      (Struct.TurnResult.get_attack_actor_index attack) -      (Struct.TurnResult.get_attack_target_index attack) -      (Struct.TurnResult.get_attack_data attack)     ) diff --git a/src/battle/src/View/SubMenu/Timeline/Attack.elm b/src/battle/src/View/SubMenu/Timeline/Attack.elm index 1899ab4..2c92b87 100644 --- a/src/battle/src/View/SubMenu/Timeline/Attack.elm +++ b/src/battle/src/View/SubMenu/Timeline/Attack.elm @@ -12,7 +12,6 @@ import BattleCharacters.Struct.Character  -- Local Module ----------------------------------------------------------------  import Struct.Attack  import Struct.Event -import Struct.TurnResult  import Struct.Character  import View.Character @@ -49,24 +48,25 @@ get_title_html attacker defender =  get_effect_text : Struct.Attack.Type -> String  get_effect_text attack = +   let precision = (Struct.Attack.get_precision attack) in     (        ( -         case attack.precision of +         case precision of              Struct.Attack.Hit -> " hit for "              Struct.Attack.Graze -> " grazed for "              Struct.Attack.Miss -> " missed."        )        ++        ( -         if (attack.precision == Struct.Attack.Miss) +         if (precision == Struct.Attack.Miss)           then              ""           else              ( -               ((String.fromInt attack.damage) ++ " damage") +               ((String.fromInt (Struct.Attack.get_damage attack)) ++ " damage")                 ++                 ( -                  if (attack.critical) +                  if (Struct.Attack.get_is_a_critical attack)                    then " (Critical Hit)."                    else "."                 ) @@ -96,7 +96,12 @@ get_attack_html attacker defender attack =        [           (Html.text              ( -               case (attack.order, attack.parried) of +               case +                  ( +                     (Struct.Attack.get_order attack), +                     (Struct.Attack.get_is_a_parry attack) +                  ) +               of                    (Struct.Attack.Counter, True) ->                       (                          defender_name @@ -135,14 +140,14 @@ get_attack_html attacker defender attack =  get_html : (        (Array.Array Struct.Character.Type) ->        Int -> -      Struct.TurnResult.Attack -> +      Struct.Attack.Type ->        (Html.Html Struct.Event.Type)     )  get_html characters player_ix attack =     case        ( -         (Array.get attack.attacker_index characters), -         (Array.get attack.defender_index characters) +         (Array.get (Struct.Attack.get_actor_index attack) characters), +         (Array.get (Struct.Attack.get_target_index attack) characters)        )     of        ((Just atkchar), (Just defchar)) -> @@ -158,7 +163,7 @@ get_html characters player_ix attack =                 (get_attack_html                    atkchar                    defchar -                  (Struct.TurnResult.get_attack_data attack) +                  attack                 )              ]           ) | 


