summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2020-01-14 17:55:15 +0100
committernsensfel <SpamShield0@noot-noot.org>2020-01-14 17:55:15 +0100
commitdc7c1857845a5da7cd6cba178c16fa8ea8c68cec (patch)
tree0fd4fcbbbabd3654995abe6e5d6716d0213763ba /src/battle/src/View
parent0db9aabba95a33fd23c192343721559f9ca15581 (diff)
...
Diffstat (limited to 'src/battle/src/View')
-rw-r--r--src/battle/src/View/Character.elm8
-rw-r--r--src/battle/src/View/Controlled/CharacterCard.elm6
-rw-r--r--src/battle/src/View/MessageBoard.elm28
-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.elm4
-rw-r--r--src/battle/src/View/SubMenu/Timeline/Movement.elm2
-rw-r--r--src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm2
7 files changed, 79 insertions, 109 deletions
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