summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/battle/src/View/Map/Character.elm')
-rw-r--r-- | src/battle/src/View/Map/Character.elm | 129 |
1 files changed, 16 insertions, 113 deletions
diff --git a/src/battle/src/View/Map/Character.elm b/src/battle/src/View/Map/Character.elm index b20c29a..b1442b1 100644 --- a/src/battle/src/View/Map/Character.elm +++ b/src/battle/src/View/Map/Character.elm @@ -16,80 +16,13 @@ import BattleCharacters.Struct.Equipment -- Local Module ---------------------------------------------------------------- import Constants.UI -import Struct.Battle import Struct.Character -import Struct.CharacterTurn import Struct.Event -import Struct.Model -import Struct.TurnResult -import Struct.TurnResultAnimator import Struct.UI -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_animation_class : ( - Struct.Model.Type -> - Struct.Character.Type -> - (Html.Attribute Struct.Event.Type) - ) -get_animation_class model char = - case model.animator of - Nothing -> (Html.Attributes.class "") - (Just animator) -> - case (Struct.TurnResultAnimator.get_current_animation animator) of - (Struct.TurnResultAnimator.Focus char_index) -> - if ((Struct.Character.get_index char) /= char_index) - then - (Html.Attributes.class "") - else - (Html.Attributes.class "character-selected") - - (Struct.TurnResultAnimator.TurnResult current_action) -> - if - ( - (Struct.TurnResult.get_actor_index current_action) - /= - (Struct.Character.get_index char) - ) - then - (Html.Attributes.class "") - else - case current_action of - (Struct.TurnResult.Moved _) -> - (Html.Attributes.class - "animated-character-icon" - ) - - _ -> (Html.Attributes.class "") - _ -> (Html.Attributes.class "") - -get_activation_level_class : ( - Struct.Character.Type -> - (Html.Attribute Struct.Event.Type) - ) -get_activation_level_class char = - if (Struct.Character.is_enabled char) - then - (Html.Attributes.class "character-icon-enabled") - else - (Html.Attributes.class "character-icon-disabled") - -get_alliance_class : ( - Struct.Model.Type -> - Struct.Character.Type -> - (Html.Attribute Struct.Event.Type) - ) -get_alliance_class model char = - if - ( - (Struct.Character.get_player_index char) - == - (Struct.Battle.get_own_player_index model.battle) - ) - then (Html.Attributes.class "character-ally") - else (Html.Attributes.class "character-enemy") - get_position_style : ( Struct.Character.Type -> (List (Html.Attribute Struct.Event.Type)) @@ -107,32 +40,6 @@ get_position_style char = ) ] -get_focus_class : ( - Struct.Model.Type -> - Struct.Character.Type -> - (Html.Attribute Struct.Event.Type) - ) -get_focus_class model char = - if - ( - (Struct.UI.get_previous_action model.ui) - == - (Just (Struct.UI.SelectedCharacter (Struct.Character.get_index char))) - ) - then - (Html.Attributes.class "character-selected") - else - if - ( - (Struct.CharacterTurn.try_getting_target model.char_turn) - == - (Just (Struct.Character.get_index char)) - ) - then - (Html.Attributes.class "character-targeted") - else - (Html.Attributes.class "") - get_body_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) get_body_html char = (Html.div @@ -195,21 +102,13 @@ get_banner_html char = _ -> (Util.Html.nothing) -get_actual_html : ( - Struct.Model.Type -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_actual_html model char = +get_actual_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) +get_actual_html char = (Html.div ( [ (Html.Attributes.class "tiled"), (Html.Attributes.class "character-icon"), - (get_animation_class model char), - (get_activation_level_class char), - (get_alliance_class model char), - (get_focus_class model char), (Html.Attributes.class "clickable"), (Html.Events.onClick (Struct.Event.CharacterSelected @@ -218,6 +117,16 @@ get_actual_html model char = ) ] ++ + (List.map + ( + \effect_name -> + (Html.Attributes.class + ("character-icon-effect-" ++ effect_name) + ) + ) + (Struct.Character.get_extra_display_effects_list char) + ) + ++ (get_position_style char) ) [ @@ -230,14 +139,8 @@ get_actual_html model char = -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- -------------------------------------------------------------------------------- -get_html : ( - Struct.Model.Type -> - Struct.Character.Type -> - (Html.Html Struct.Event.Type) - ) -get_html model char = +get_html : Struct.Character.Type -> (Html.Html Struct.Event.Type) +get_html char = if (Struct.Character.is_alive char) - then - (get_actual_html model char) - else - (Util.Html.nothing) + then (get_actual_html char) + else (Util.Html.nothing) |