summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-11-22 17:38:18 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-11-22 17:38:18 +0100
commit056513525e544d73ce8917739654c0ea0a437c2c (patch)
treeea348195b6684381631de6153e6ab01474327ca6 /src/battle/src/View
parentf6f7a84e71cc0affd7bfd2ea51a7e67202586836 (diff)
...
Diffstat (limited to 'src/battle/src/View')
-rw-r--r--src/battle/src/View/Controlled/Targets.elm14
-rw-r--r--src/battle/src/View/Map.elm13
-rw-r--r--src/battle/src/View/MessageBoard.elm2
-rw-r--r--src/battle/src/View/MessageBoard/Animator.elm16
-rw-r--r--src/battle/src/View/MessageBoard/Animator/Attack.elm37
-rw-r--r--src/battle/src/View/SubMenu/Status.elm12
-rw-r--r--src/battle/src/View/SubMenu/Status/TileInfo.elm157
-rw-r--r--src/battle/src/View/SubMenu/Timeline.elm24
8 files changed, 55 insertions, 220 deletions
diff --git a/src/battle/src/View/Controlled/Targets.elm b/src/battle/src/View/Controlled/Targets.elm
index 3457731..7dd5636 100644
--- a/src/battle/src/View/Controlled/Targets.elm
+++ b/src/battle/src/View/Controlled/Targets.elm
@@ -10,21 +10,21 @@ import Html.Attributes
import Battle.Struct.Attributes
-- Local Module ----------------------------------------------------------------
+import Struct.Battle
import Struct.Character
import Struct.Event
-import Struct.Model
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_target_info_html : (
- Struct.Model.Type ->
+ Struct.Battle.Type ->
Struct.Character.Ref ->
(Html.Html Struct.Event.Type)
)
-get_target_info_html model char_ref =
- case (Dict.get char_ref model.characters) of
+get_target_info_html battle char_ref =
+ case (Struct.Battle.get_character char_ref battle) of
Nothing -> (Html.text "Error: Unknown character selected.")
(Just char) ->
(Html.text
@@ -61,14 +61,14 @@ get_target_info_html model char_ref =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Struct.Model.Type ->
+ Struct.Battle.Type ->
Struct.Character.Ref ->
(Html.Html Struct.Event.Type)
)
-get_html model target_ref =
+get_html battle target_ref =
(Html.div
[
(Html.Attributes.class "side-bar-targets")
]
- [(get_target_info_html model target_ref)]
+ [(get_target_info_html battle target_ref)]
)
diff --git a/src/battle/src/View/Map.elm b/src/battle/src/View/Map.elm
index dc0c770..d95aa21 100644
--- a/src/battle/src/View/Map.elm
+++ b/src/battle/src/View/Map.elm
@@ -99,17 +99,16 @@ maybe_print_navigator interactive maybe_nav =
get_characters_html : (
Struct.Model.Type ->
- (Array.Array Struct.Character.Type) ->
(Html.Html Struct.Event.Type)
)
-get_characters_html model characters =
+get_characters_html model =
(Html.div
[
(Html.Attributes.class "characters")
]
(List.map
(View.Map.Character.get_html model)
- (Array.toList model.characters)
+ (Array.toList (Struct.Battle.get_characters model.battle))
)
)
@@ -142,10 +141,8 @@ get_html model =
)
]
[
- (Html.Lazy.lazy (get_tiles_html) model.map),
- -- Not in lazy mode, because I can't easily get rid of that 'model'
- -- parameter.
- (get_characters_html model model.characters),
+ (Html.Lazy.lazy (get_tiles_html) model.battle.map),
+ (Html.Lazy.lazy (get_characters_html model)),
(Html.Lazy.lazy2
(maybe_print_navigator)
True
@@ -154,7 +151,7 @@ get_html model =
(Html.Lazy.lazy2
(maybe_print_navigator)
False
- (Struct.UI.try_getting_displayed_nav model.ui)
+ model.ui.displayed_nav
)
]
)
diff --git a/src/battle/src/View/MessageBoard.elm b/src/battle/src/View/MessageBoard.elm
index 082d2c9..9b31f65 100644
--- a/src/battle/src/View/MessageBoard.elm
+++ b/src/battle/src/View/MessageBoard.elm
@@ -25,6 +25,6 @@ get_html model =
Nothing ->
case model.animator of
(Just animator) ->
- (View.MessageBoard.Animator.get_html model animator)
+ (View.MessageBoard.Animator.get_html model.battle animator)
Nothing -> (View.MessageBoard.Help.get_html model)
diff --git a/src/battle/src/View/MessageBoard/Animator.elm b/src/battle/src/View/MessageBoard/Animator.elm
index c653e5e..99ff190 100644
--- a/src/battle/src/View/MessageBoard/Animator.elm
+++ b/src/battle/src/View/MessageBoard/Animator.elm
@@ -7,8 +7,8 @@ import Html
import Util.Html
-- Local Module ----------------------------------------------------------------
+import Struct.Battle
import Struct.Event
-import Struct.Model
import Struct.TurnResult
import Struct.TurnResultAnimator
@@ -18,15 +18,15 @@ import View.MessageBoard.Animator.Attack
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_turn_result_html : (
- Struct.Model.Type ->
+ Struct.Battle.Type ->
Struct.TurnResult.Type ->
(Html.Html Struct.Event.Type)
)
-get_turn_result_html model turn_result =
+get_turn_result_html battle turn_result =
case turn_result of
(Struct.TurnResult.Attacked attack) ->
(View.MessageBoard.Animator.Attack.get_html
- model
+ battle
(Struct.TurnResult.get_actor_index turn_result)
(Struct.TurnResult.get_attack_defender_index attack)
(Struct.TurnResult.maybe_get_attack_next_step attack)
@@ -38,18 +38,18 @@ get_turn_result_html model turn_result =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Struct.Model.Type ->
+ Struct.Battle.Type ->
Struct.TurnResultAnimator.Type ->
(Html.Html Struct.Event.Type)
)
-get_html model animator =
+get_html battle animator =
case (Struct.TurnResultAnimator.get_current_animation animator) of
(Struct.TurnResultAnimator.TurnResult turn_result) ->
- (get_turn_result_html model turn_result)
+ (get_turn_result_html battle turn_result)
(Struct.TurnResultAnimator.AttackSetup (attacker_id, defender_id)) ->
(View.MessageBoard.Animator.Attack.get_html
- model
+ battle
attacker_id
defender_id
Nothing
diff --git a/src/battle/src/View/MessageBoard/Animator/Attack.elm b/src/battle/src/View/MessageBoard/Animator/Attack.elm
index 4378c5a..6b79903 100644
--- a/src/battle/src/View/MessageBoard/Animator/Attack.elm
+++ b/src/battle/src/View/MessageBoard/Animator/Attack.elm
@@ -11,9 +11,9 @@ import BattleCharacters.Struct.Character
-- Local Module ----------------------------------------------------------------
import Struct.Attack
+import Struct.Battle
import Struct.Character
import Struct.Event
-import Struct.Model
import View.Controlled.CharacterCard
@@ -120,10 +120,8 @@ get_attack_animation_class : (
)
get_attack_animation_class attack char =
if (attack.critical)
- then
- "animated-portrait-attack-critical"
- else
- "animated-portrait-attacks"
+ then "animated-portrait-attack-critical"
+ else "animated-portrait-attacks"
get_defense_animation_class : (
Struct.Attack.Type ->
@@ -134,23 +132,17 @@ get_defense_animation_class attack char =
if (attack.damage == 0)
then
if (attack.precision == Struct.Attack.Miss)
- then
- "animated-portrait-dodges"
- else
- "animated-portrait-undamaged"
+ then "animated-portrait-dodges"
+ else "animated-portrait-undamaged"
else if ((Struct.Character.get_current_health char) > 0)
then
if (attack.precision == Struct.Attack.Graze)
- then
- "animated-portrait-grazed-damage"
- else
- "animated-portrait-damaged"
+ then "animated-portrait-grazed-damage"
+ else "animated-portrait-damaged"
else
if (attack.precision == Struct.Attack.Graze)
- then
- "animated-portrait-grazed-death"
- else
- "animated-portrait-dies"
+ then "animated-portrait-grazed-death"
+ else "animated-portrait-dies"
get_attacker_card : (
(Maybe Struct.Attack.Type) ->
@@ -297,11 +289,16 @@ get_placeholder_html characters attacker_ix defender_ix maybe_attack =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Struct.Model.Type ->
+ Struct.Battle.Type ->
Int ->
Int ->
(Maybe Struct.Attack.Type) ->
(Html.Html Struct.Event.Type)
)
-get_html model attacker_ix defender_ix maybe_attack =
- (get_placeholder_html model.characters attacker_ix defender_ix maybe_attack)
+get_html battle attacker_ix defender_ix maybe_attack =
+ (get_placeholder_html
+ (Struct.Battle.get_characters battle)
+ attacker_ix
+ defender_ix
+ maybe_attack
+ )
diff --git a/src/battle/src/View/SubMenu/Status.elm b/src/battle/src/View/SubMenu/Status.elm
index b5d69f7..af5ace3 100644
--- a/src/battle/src/View/SubMenu/Status.elm
+++ b/src/battle/src/View/SubMenu/Status.elm
@@ -10,13 +10,15 @@ import Html.Lazy
-- Battle Map ------------------------------------------------------------------
import BattleMap.Struct.Location
+import BattleMap.View.TileInfo
+
-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.UI
import View.SubMenu.Status.CharacterInfo
-import View.SubMenu.Status.TileInfo
+
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -34,9 +36,11 @@ get_html model =
[
(case (Struct.UI.get_previous_action model.ui) of
(Just (Struct.UI.SelectedLocation loc)) ->
- (View.SubMenu.Status.TileInfo.get_html
- model
- (BattleMap.Struct.Location.from_ref loc)
+ (Html.Lazy.lazy3
+ (BattleMap.View.TileInfo.get_html)
+ model.map_dataset
+ loc
+ model.battle.map
)
(Just (Struct.UI.SelectedCharacter target_char)) ->
diff --git a/src/battle/src/View/SubMenu/Status/TileInfo.elm b/src/battle/src/View/SubMenu/Status/TileInfo.elm
deleted file mode 100644
index ff983b2..0000000
--- a/src/battle/src/View/SubMenu/Status/TileInfo.elm
+++ /dev/null
@@ -1,157 +0,0 @@
-module View.SubMenu.Status.TileInfo exposing (get_html)
-
--- Elm -------------------------------------------------------------------------
-import Dict
-
-import Html
-import Html.Attributes
-
--- Shared ----------------------------------------------------------------------
-import Util.Html
-
--- Battle ----------------------------------------------------------------------
-import Battle.Struct.Omnimods
-
-import Battle.View.Omnimods
-
--- Battle Map ------------------------------------------------------------------
-import BattleMap.Struct.Location
-import BattleMap.Struct.Map
-import BattleMap.Struct.Tile
-import BattleMap.Struct.TileInstance
-
-import BattleMap.View.Tile
-
--- Local Module ----------------------------------------------------------------
-import Constants.Movement
-
-import Struct.Event
-import Struct.Model
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_icon : (BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
-get_icon tile =
- (Html.div
- [
- (Html.Attributes.class "tile-card-icon"),
- (Html.Attributes.class "info-card-picture"),
- (Html.Attributes.class
- (
- "tile-variant-"
- ++
- (String.fromInt
- (BattleMap.Struct.TileInstance.get_local_variant_ix tile)
- )
- )
- )
- ]
- (BattleMap.View.Tile.get_content_html tile)
- )
-
-get_name : (
- Struct.Model.Type ->
- BattleMap.Struct.TileInstance.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_name model tile_inst =
- case
- (Dict.get
- (BattleMap.Struct.TileInstance.get_class_id tile_inst)
- model.tiles
- )
- of
- Nothing -> (Util.Html.nothing)
- (Just tile) ->
- (Html.div
- [
- (Html.Attributes.class "info-card-name"),
- (Html.Attributes.class "info-card-text-field"),
- (Html.Attributes.class "tile-card-name")
- ]
- [
- (Html.text (BattleMap.Struct.Tile.get_name tile))
- ]
- )
-
-get_cost : BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
-get_cost tile_inst =
- let
- cost = (BattleMap.Struct.TileInstance.get_cost tile_inst)
- text =
- if (cost > Constants.Movement.max_points)
- then
- "Obstructed"
- else
- ("Cost: " ++ (String.fromInt cost))
- in
- (Html.div
- [
- (Html.Attributes.class "info-card-text-field"),
- (Html.Attributes.class "tile-card-cost")
- ]
- [
- (Html.text text)
- ]
- )
-
-get_location : BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
-get_location tile_inst =
- let
- tile_location = (BattleMap.Struct.TileInstance.get_location tile_inst)
- in
- (Html.div
- [
- (Html.Attributes.class "info-card-text-field"),
- (Html.Attributes.class "tile-card-location")
- ]
- [
- (Html.text
- (
- "{x: "
- ++ (String.fromInt tile_location.x)
- ++ "; y: "
- ++ (String.fromInt tile_location.y)
- ++ "}"
- )
- )
- ]
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_html : (
- Struct.Model.Type ->
- BattleMap.Struct.Location.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_html model loc =
- case (BattleMap.Struct.Map.try_getting_tile_at loc model.map) of
- (Just tile) ->
- (Html.div
- [
- (Html.Attributes.class "info-card"),
- (Html.Attributes.class "tile-card")
- ]
- [
- (get_name model tile),
- (Html.div
- [
- (Html.Attributes.class "info-card-top"),
- (Html.Attributes.class "tile-card-top")
- ]
- [
- (get_icon tile),
- (get_location tile),
- (get_cost tile)
- ]
- ),
- (Battle.View.Omnimods.get_signed_html
- ((Struct.Model.tile_omnimods_fun model) loc)
- )
- ]
- )
-
- Nothing -> (Html.text "Error: Unknown tile location selected.")
diff --git a/src/battle/src/View/SubMenu/Timeline.elm b/src/battle/src/View/SubMenu/Timeline.elm
index 50c1ba3..7c081f4 100644
--- a/src/battle/src/View/SubMenu/Timeline.elm
+++ b/src/battle/src/View/SubMenu/Timeline.elm
@@ -8,6 +8,7 @@ import Html.Attributes
import Html.Lazy
-- Local Module ----------------------------------------------------------------
+import Struct.Battle
import Struct.Character
import Struct.Event
import Struct.TurnResult
@@ -61,13 +62,8 @@ get_turn_result_html characters player_ix turn_result =
(Struct.TurnResult.PlayerTurnStarted pturns) ->
(View.SubMenu.Timeline.PlayerTurnStart.get_html pturns)
-true_get_html : (
- (Array.Array Struct.Character.Type) ->
- Int ->
- (Array.Array Struct.TurnResult.Type) ->
- (Html.Html Struct.Event.Type)
- )
-true_get_html characters player_ix turn_results =
+true_get_html : Struct.Battle.Type -> (Html.Html Struct.Event.Type)
+true_get_html battle =
(Html.div
[
(Html.Attributes.class "tabmenu-content"),
@@ -75,8 +71,11 @@ true_get_html characters player_ix turn_results =
]
(Array.toList
(Array.map
- (get_turn_result_html characters player_ix)
- turn_results
+ (get_turn_result_html
+ (Struct.Battle.get_characters battle)
+ (Struct.Battle.get_own_player_index battle)
+ )
+ (Struct.Battle.get_turn_results battle)
)
)
)
@@ -86,9 +85,4 @@ true_get_html characters player_ix turn_results =
--------------------------------------------------------------------------------
get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type)
get_html model =
- (Html.Lazy.lazy3
- (true_get_html)
- model.characters
- model.player_ix
- model.timeline
- )
+ (Html.Lazy.lazy (true_get_html) model.battle)