From 17ed7ee567051f7a71da0ff292ac5de637f8a206 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 30 May 2020 22:15:57 +0200 Subject: Improves code and animations for attacks. --- src/battle/src/Struct/Attack.elm | 57 ++++++- src/battle/src/Struct/MessageBoard.elm | 4 +- src/battle/src/Struct/PuppeteerAction.elm | 63 ++++---- src/battle/src/Struct/TurnResult.elm | 43 +---- src/battle/src/Update/Puppeteer/Hit.elm | 95 +++-------- src/battle/src/View/MessageBoard/Animator.elm | 58 ------- src/battle/src/View/MessageBoard/Attack.elm | 184 ++++++++++------------ src/battle/src/View/SubMenu/Timeline/Attack.elm | 25 +-- src/css/src/battle.scss | 1 + src/css/src/battle/constants.scss | 6 +- src/css/src/battle/controlled-panel.scss | 4 +- src/css/src/shared/battle-view/constants.scss | 2 + src/css/src/shared/battle-view/info-card.scss | 2 +- src/css/src/shared/battle-view/message-board.scss | 2 +- src/css/src/shared/parameters.scss | 2 +- 15 files changed, 224 insertions(+), 324 deletions(-) delete mode 100644 src/battle/src/View/MessageBoard/Animator.elm (limited to 'src') 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 ) ] ) diff --git a/src/css/src/battle.scss b/src/css/src/battle.scss index 1977011..c730d8d 100644 --- a/src/css/src/battle.scss +++ b/src/css/src/battle.scss @@ -1,3 +1,4 @@ +@import 'battle/constants'; @import 'shared/battle-view'; @import 'shared/battle-characters'; @import 'shared/battle-map'; diff --git a/src/css/src/battle/constants.scss b/src/css/src/battle/constants.scss index 4abe652..7550a7f 100644 --- a/src/css/src/battle/constants.scss +++ b/src/css/src/battle/constants.scss @@ -1,7 +1,9 @@ -@import '../shared/battle-view/constants'; - $CONTROLLED-MENU-WIDTH: 18em; $SUB-MENU-WIDTH: 18em; +$LEFT-MENU-WIDTH: $CONTROLLED-MENU-WIDTH; + +@import '../shared/battle-view/constants'; + $NEXT-TO-CONTROLLED-MENU: $CONTROLLED-MENU-WIDTH + $MENU-EXTRA; $NEXT-TO-SUB-MENU: $SUB-MENU-WIDTH + $MENU-EXTRA; diff --git a/src/css/src/battle/controlled-panel.scss b/src/css/src/battle/controlled-panel.scss index 6001d39..589b15f 100644 --- a/src/css/src/battle/controlled-panel.scss +++ b/src/css/src/battle/controlled-panel.scss @@ -9,13 +9,15 @@ left: 0; top: $BELOW-MAIN-MENU; - bottom: $ABOVE-MESSAGE-BOARD; + bottom: 0; width: $CONTROLLED-MENU-WIDTH; border-top-left-radius: 0; border-bottom-left-radius: 0; + border-bottom-right-radius: 0; border-left: none; + border-bottom: none; display: flex; flex-flow: column; diff --git a/src/css/src/shared/battle-view/constants.scss b/src/css/src/shared/battle-view/constants.scss index 63d4bbf..f1398bd 100644 --- a/src/css/src/shared/battle-view/constants.scss +++ b/src/css/src/shared/battle-view/constants.scss @@ -3,6 +3,8 @@ $MENU-PADDING: 0.5em; $MENU-BORDER: 0.2em; $MENU-EXTRA: $MENU-MARGIN;// + $MENU-PADDING + $MENU-BORDER; +$LEFT-MENU-WIDTH: 0em !default; + $MAIN-MENU-HEIGHT: 3em; $MESSAGE-BOARD-HEIGHT: 10em; diff --git a/src/css/src/shared/battle-view/info-card.scss b/src/css/src/shared/battle-view/info-card.scss index d7839cd..6d1c608 100644 --- a/src/css/src/shared/battle-view/info-card.scss +++ b/src/css/src/shared/battle-view/info-card.scss @@ -76,7 +76,7 @@ border-radius: 5px; z-index: 0; - transition: width 3s ease-in-out; + transition: width 2s ease-in-out; } .character-card-health, diff --git a/src/css/src/shared/battle-view/message-board.scss b/src/css/src/shared/battle-view/message-board.scss index 0fc9fa7..06b4edc 100644 --- a/src/css/src/shared/battle-view/message-board.scss +++ b/src/css/src/shared/battle-view/message-board.scss @@ -5,7 +5,7 @@ { position: absolute; bottom: 0; - left: 0; + left: $LEFT-MENU-WIDTH; right: 0; height: $MESSAGE-BOARD-HEIGHT; diff --git a/src/css/src/shared/parameters.scss b/src/css/src/shared/parameters.scss index 10f8a5b..184e8a6 100644 --- a/src/css/src/shared/parameters.scss +++ b/src/css/src/shared/parameters.scss @@ -1,2 +1,2 @@ -$MIN-PAGE-WIDTH: 1024px; +$MIN-PAGE-WIDTH: 1366px; $MIN-PAGE-HEIGHT: 768px; -- cgit v1.2.3-70-g09d2