summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/battle/elm.json7
-rwxr-xr-xsrc/battle/src/Action/Scroll.elm12
-rw-r--r--src/battle/src/Comm/AddArmor.elm14
-rw-r--r--src/battle/src/Comm/AddChar.elm4
-rw-r--r--src/battle/src/Comm/AddPlayer.elm2
-rw-r--r--src/battle/src/Comm/AddPortrait.elm19
-rw-r--r--src/battle/src/Comm/AddTile.elm8
-rw-r--r--src/battle/src/Comm/AddWeapon.elm17
-rw-r--r--src/battle/src/Comm/CharacterTurn.elm3
-rw-r--r--src/battle/src/Comm/LoadBattle.elm2
-rw-r--r--src/battle/src/Comm/Send.elm2
-rw-r--r--src/battle/src/Comm/SetMap.elm8
-rw-r--r--src/battle/src/Comm/SetTimeline.elm2
-rw-r--r--src/battle/src/Comm/TurnResults.elm2
-rw-r--r--src/battle/src/ElmModule/Init.elm6
-rw-r--r--src/battle/src/ElmModule/Subscriptions.elm4
-rw-r--r--src/battle/src/ElmModule/Update.elm5
-rw-r--r--src/battle/src/ElmModule/View.elm2
-rw-r--r--src/battle/src/Main.elm6
-rw-r--r--src/battle/src/Struct/Armor.elm70
-rw-r--r--src/battle/src/Struct/Attack.elm2
-rw-r--r--src/battle/src/Struct/Attributes.elm173
-rw-r--r--src/battle/src/Struct/Character.elm141
-rw-r--r--src/battle/src/Struct/CharacterTurn.elm24
-rw-r--r--src/battle/src/Struct/Event.elm14
-rw-r--r--src/battle/src/Struct/HelpRequest.elm2
-rw-r--r--src/battle/src/Struct/Map.elm8
-rw-r--r--src/battle/src/Struct/MapMarker.elm20
-rw-r--r--src/battle/src/Struct/Model.elm95
-rw-r--r--src/battle/src/Struct/Navigator.elm38
-rw-r--r--src/battle/src/Struct/Path.elm46
-rw-r--r--src/battle/src/Struct/Player.elm2
-rw-r--r--src/battle/src/Struct/Portrait.elm68
-rw-r--r--src/battle/src/Struct/RangeIndicator.elm72
-rw-r--r--src/battle/src/Struct/ServerReply.elm27
-rw-r--r--src/battle/src/Struct/TurnResult.elm46
-rw-r--r--src/battle/src/Struct/TurnResultAnimator.elm5
-rw-r--r--src/battle/src/Struct/UI.elm8
-rw-r--r--src/battle/src/Struct/Weapon.elm99
-rw-r--r--src/battle/src/Struct/WeaponSet.elm39
-rw-r--r--src/battle/src/Update/AbortTurn.elm4
-rw-r--r--src/battle/src/Update/AttackWithoutMoving.elm9
-rw-r--r--src/battle/src/Update/ChangeScale.elm3
-rw-r--r--src/battle/src/Update/DisplayCharacterInfo.elm3
-rw-r--r--src/battle/src/Update/EndTurn.elm4
-rw-r--r--src/battle/src/Update/GoToMainMenu.elm4
-rw-r--r--src/battle/src/Update/HandleAnimationEnded.elm2
-rw-r--r--src/battle/src/Update/HandleServerReply.elm50
-rw-r--r--src/battle/src/Update/LookForCharacter.elm9
-rw-r--r--src/battle/src/Update/RequestDirection.elm10
-rw-r--r--src/battle/src/Update/SelectCharacter.elm31
-rw-r--r--src/battle/src/Update/SelectCharacterOrTile.elm15
-rw-r--r--src/battle/src/Update/SelectTab.elm3
-rw-r--r--src/battle/src/Update/SelectTile.elm16
-rw-r--r--src/battle/src/Update/SendLoadBattleRequest.elm8
-rw-r--r--src/battle/src/Update/SetRequestedHelp.elm3
-rw-r--r--src/battle/src/Update/SwitchTeam.elm8
-rw-r--r--src/battle/src/Update/SwitchWeapon.elm24
-rw-r--r--src/battle/src/Update/TestAnimation.elm7
-rw-r--r--src/battle/src/Update/UndoAction.elm34
-rw-r--r--src/battle/src/View/Character.elm26
-rw-r--r--src/battle/src/View/Controlled.elm7
-rw-r--r--src/battle/src/View/Controlled/CharacterCard.elm153
-rw-r--r--src/battle/src/View/Controlled/ManualControls.elm16
-rw-r--r--src/battle/src/View/Controlled/Targets.elm10
-rw-r--r--src/battle/src/View/Gauge.elm2
-rw-r--r--src/battle/src/View/MainMenu.elm2
-rw-r--r--src/battle/src/View/Map.elm25
-rw-r--r--src/battle/src/View/Map/Character.elm13
-rw-r--r--src/battle/src/View/Map/Navigator.elm46
-rw-r--r--src/battle/src/View/Map/Tile.elm130
-rw-r--r--src/battle/src/View/MessageBoard.elm2
-rw-r--r--src/battle/src/View/MessageBoard/Animator.elm7
-rw-r--r--src/battle/src/View/MessageBoard/Animator/Attack.elm3
-rw-r--r--src/battle/src/View/MessageBoard/Error.elm2
-rw-r--r--src/battle/src/View/MessageBoard/Help.elm2
-rw-r--r--src/battle/src/View/MessageBoard/Help/Guide.elm2
-rw-r--r--src/battle/src/View/MessageBoard/Help/Rank.elm2
-rw-r--r--src/battle/src/View/SubMenu.elm7
-rw-r--r--src/battle/src/View/SubMenu/Characters.elm4
-rw-r--r--src/battle/src/View/SubMenu/Settings.elm2
-rw-r--r--src/battle/src/View/SubMenu/Status.elm8
-rw-r--r--src/battle/src/View/SubMenu/Status/CharacterInfo.elm2
-rw-r--r--src/battle/src/View/SubMenu/Status/TileInfo.elm70
-rw-r--r--src/battle/src/View/SubMenu/Timeline.elm3
-rw-r--r--src/battle/src/View/SubMenu/Timeline/Attack.elm3
-rw-r--r--src/battle/src/View/SubMenu/Timeline/Movement.elm3
-rw-r--r--src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm3
-rw-r--r--src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm3
-rw-r--r--src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm3
-rw-r--r--src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm3
-rw-r--r--src/map-editor/elm.json6
-rw-r--r--src/map-editor/src/Struct/TileInstance.elm6
-rw-r--r--src/map-editor/src/View/Map/Tile.elm119
-rw-r--r--src/map-editor/src/View/SubMenu.elm8
-rw-r--r--src/roster-editor/elm.json4
-rw-r--r--src/roster-editor/src/Struct/Omnimods.elm214
-rw-r--r--src/roster-editor/src/Struct/Statistics.elm210
-rw-r--r--src/roster-editor/src/Struct/UI.elm16
-rw-r--r--src/shared/battle-characters/BattleCharacters/Comm/AddPortrait.elm (renamed from src/roster-editor/src/Struct/DamageType.elm)49
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Armor.elm (renamed from src/roster-editor/src/Struct/Armor.elm)14
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm (renamed from src/roster-editor/src/Struct/Portrait.elm)4
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm (renamed from src/roster-editor/src/Struct/Weapon.elm)18
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Direction.elm (renamed from src/battle/src/Struct/Direction.elm)10
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Location.elm (renamed from src/battle/src/Struct/Location.elm)18
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Map.elm206
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Tile.elm (renamed from src/battle/src/Struct/Tile.elm)24
-rw-r--r--src/shared/battle-map/BattleMap/Struct/TileInstance.elm (renamed from src/battle/src/Struct/TileInstance.elm)108
-rw-r--r--src/shared/battle-map/BattleMap/View/Tile.elm242
-rw-r--r--src/shared/battle/Battle/Struct/Attributes.elm (renamed from src/roster-editor/src/Struct/Attributes.elm)6
-rw-r--r--src/shared/battle/Battle/Struct/DamageType.elm (renamed from src/battle/src/Struct/DamageType.elm)4
-rw-r--r--src/shared/battle/Battle/Struct/Omnimods.elm (renamed from src/battle/src/Struct/Omnimods.elm)20
-rw-r--r--src/shared/battle/Battle/Struct/Statistics.elm (renamed from src/battle/src/Struct/Statistics.elm)18
-rw-r--r--src/shared/battle/Battle/View/Omnimods.elm181
114 files changed, 1593 insertions, 1847 deletions
diff --git a/src/battle/elm.json b/src/battle/elm.json
index 706bb2d..f16ab85 100644
--- a/src/battle/elm.json
+++ b/src/battle/elm.json
@@ -2,7 +2,10 @@
"type": "application",
"source-directories": [
"src",
- "../shared/elm"
+ "../shared/elm",
+ "../shared/battle",
+ "../shared/battle-map",
+ "../shared/battle-characters"
],
"elm-version": "0.19.0",
"dependencies": {
@@ -27,4 +30,4 @@
"direct": {},
"indirect": {}
}
-} \ No newline at end of file
+}
diff --git a/src/battle/src/Action/Scroll.elm b/src/battle/src/Action/Scroll.elm
index 4f781eb..8ebbad3 100755
--- a/src/battle/src/Action/Scroll.elm
+++ b/src/battle/src/Action/Scroll.elm
@@ -5,11 +5,13 @@ import Browser.Dom
import Task
--- Map -------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Constants.UI
import Struct.UI
-import Struct.Location
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -27,7 +29,11 @@ tile_to_px ui t =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-to : Struct.Location.Type -> Struct.UI.Type -> (Task.Task Browser.Dom.Error ())
+to : (
+ BattleMap.Struct.Location.Type ->
+ Struct.UI.Type ->
+ (Task.Task Browser.Dom.Error ())
+ )
to loc ui =
(Browser.Dom.setViewportOf
Constants.UI.viewer_html_id
diff --git a/src/battle/src/Comm/AddArmor.elm b/src/battle/src/Comm/AddArmor.elm
index 480b823..5dd7aad 100644
--- a/src/battle/src/Comm/AddArmor.elm
+++ b/src/battle/src/Comm/AddArmor.elm
@@ -3,8 +3,10 @@ module Comm.AddArmor exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
-import Struct.Armor
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -14,11 +16,15 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-internal_decoder : Struct.Armor.Type -> Struct.ServerReply.Type
+internal_decoder : BattleCharacters.Struct.Armor.Type -> Struct.ServerReply.Type
internal_decoder ar = (Struct.ServerReply.AddArmor ar)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
decode : (Json.Decode.Decoder Struct.ServerReply.Type)
-decode = (Json.Decode.map (internal_decoder) (Struct.Armor.decoder))
+decode =
+ (Json.Decode.map
+ (internal_decoder)
+ (BattleCharacters.Struct.Armor.decoder)
+ )
diff --git a/src/battle/src/Comm/AddChar.elm b/src/battle/src/Comm/AddChar.elm
index 9b36f69..9b63c6f 100644
--- a/src/battle/src/Comm/AddChar.elm
+++ b/src/battle/src/Comm/AddChar.elm
@@ -3,10 +3,8 @@ module Comm.AddChar exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
-import Struct.Weapon
-import Struct.Armor
import Struct.ServerReply
--------------------------------------------------------------------------------
diff --git a/src/battle/src/Comm/AddPlayer.elm b/src/battle/src/Comm/AddPlayer.elm
index b902825..cd6fb6a 100644
--- a/src/battle/src/Comm/AddPlayer.elm
+++ b/src/battle/src/Comm/AddPlayer.elm
@@ -3,7 +3,7 @@ module Comm.AddPlayer exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Battle ----------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Player
import Struct.ServerReply
diff --git a/src/battle/src/Comm/AddPortrait.elm b/src/battle/src/Comm/AddPortrait.elm
index 1cceb5f..321684c 100644
--- a/src/battle/src/Comm/AddPortrait.elm
+++ b/src/battle/src/Comm/AddPortrait.elm
@@ -1,10 +1,12 @@
-module Comm.AddPortrait exposing (decode)
+module BattleCharacters.Comm.AddPortrait exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Battle ----------------------------------------------------------------------
-import Struct.Portrait
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Portrait
+
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -14,11 +16,18 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-internal_decoder : Struct.Portrait.Type -> Struct.ServerReply.Type
+internal_decoder : (
+ BattleCharacters.Struct.Portrait.Type ->
+ Struct.ServerReply.Type
+ )
internal_decoder pt = (Struct.ServerReply.AddPortrait pt)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
decode : (Json.Decode.Decoder Struct.ServerReply.Type)
-decode = (Json.Decode.map (internal_decoder) (Struct.Portrait.decoder))
+decode =
+ (Json.Decode.map
+ (internal_decoder)
+ (BattleCharacters.Struct.Portrait.decoder)
+ )
diff --git a/src/battle/src/Comm/AddTile.elm b/src/battle/src/Comm/AddTile.elm
index 64cf0ea..6b27310 100644
--- a/src/battle/src/Comm/AddTile.elm
+++ b/src/battle/src/Comm/AddTile.elm
@@ -3,8 +3,10 @@ module Comm.AddTile exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
-import Struct.Tile
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -21,4 +23,4 @@ internal_decoder wp = (Struct.ServerReply.AddTile wp)
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
decode : (Json.Decode.Decoder Struct.ServerReply.Type)
-decode = (Json.Decode.map (internal_decoder) (Struct.Tile.decoder))
+decode = (Json.Decode.map (internal_decoder) (BattleMap.Struct.Tile.decoder))
diff --git a/src/battle/src/Comm/AddWeapon.elm b/src/battle/src/Comm/AddWeapon.elm
index 7061dea..307dc6a 100644
--- a/src/battle/src/Comm/AddWeapon.elm
+++ b/src/battle/src/Comm/AddWeapon.elm
@@ -3,8 +3,10 @@ module Comm.AddWeapon exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
-import Struct.Weapon
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Weapon
+
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -14,11 +16,18 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-internal_decoder : Struct.Weapon.Type -> Struct.ServerReply.Type
+internal_decoder : (
+ BattleCharacters.Struct.Weapon.Type ->
+ Struct.ServerReply.Type
+ )
internal_decoder wp = (Struct.ServerReply.AddWeapon wp)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
decode : (Json.Decode.Decoder Struct.ServerReply.Type)
-decode = (Json.Decode.map (internal_decoder) (Struct.Weapon.decoder))
+decode =
+ (Json.Decode.map
+ (internal_decoder)
+ (BattleCharacters.Struct.Weapon.decoder)
+ )
diff --git a/src/battle/src/Comm/CharacterTurn.elm b/src/battle/src/Comm/CharacterTurn.elm
index 7809b00..6e3612f 100644
--- a/src/battle/src/Comm/CharacterTurn.elm
+++ b/src/battle/src/Comm/CharacterTurn.elm
@@ -3,14 +3,13 @@ module Comm.CharacterTurn exposing (try)
-- Elm -------------------------------------------------------------------------
import Json.Encode
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Constants.IO
import Comm.Send
import Struct.Character
import Struct.CharacterTurn
-import Struct.Direction
import Struct.Event
import Struct.Model
diff --git a/src/battle/src/Comm/LoadBattle.elm b/src/battle/src/Comm/LoadBattle.elm
index df4e9dd..78a337f 100644
--- a/src/battle/src/Comm/LoadBattle.elm
+++ b/src/battle/src/Comm/LoadBattle.elm
@@ -3,7 +3,7 @@ module Comm.LoadBattle exposing (try)
-- Elm -------------------------------------------------------------------------
import Json.Encode
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.Send
import Constants.IO
diff --git a/src/battle/src/Comm/Send.elm b/src/battle/src/Comm/Send.elm
index 68dda5d..3394b26 100644
--- a/src/battle/src/Comm/Send.elm
+++ b/src/battle/src/Comm/Send.elm
@@ -6,7 +6,7 @@ import Http
import Json.Decode
import Json.Encode
--- Battle ----------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.AddArmor
import Comm.AddPortrait
import Comm.AddPlayer
diff --git a/src/battle/src/Comm/SetMap.elm b/src/battle/src/Comm/SetMap.elm
index 10d527a..80f6db1 100644
--- a/src/battle/src/Comm/SetMap.elm
+++ b/src/battle/src/Comm/SetMap.elm
@@ -3,8 +3,10 @@ module Comm.SetMap exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------------
-import Struct.Map
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -22,5 +24,5 @@ decode : (Json.Decode.Decoder Struct.ServerReply.Type)
decode =
(Json.Decode.map
(\map -> (Struct.ServerReply.SetMap map))
- (Struct.Map.decoder)
+ (BattleMap.Struct.Map.decoder)
)
diff --git a/src/battle/src/Comm/SetTimeline.elm b/src/battle/src/Comm/SetTimeline.elm
index 3956ec3..865a575 100644
--- a/src/battle/src/Comm/SetTimeline.elm
+++ b/src/battle/src/Comm/SetTimeline.elm
@@ -3,7 +3,7 @@ module Comm.SetTimeline exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
import Struct.TurnResult
diff --git a/src/battle/src/Comm/TurnResults.elm b/src/battle/src/Comm/TurnResults.elm
index f8727e1..09fbc55 100644
--- a/src/battle/src/Comm/TurnResults.elm
+++ b/src/battle/src/Comm/TurnResults.elm
@@ -3,7 +3,7 @@ module Comm.TurnResults exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
import Struct.TurnResult
diff --git a/src/battle/src/ElmModule/Init.elm b/src/battle/src/ElmModule/Init.elm
index 4fccd82..bc90dad 100644
--- a/src/battle/src/ElmModule/Init.elm
+++ b/src/battle/src/ElmModule/Init.elm
@@ -1,12 +1,12 @@
module ElmModule.Init exposing (init)
--- Elm -------------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Struct.Flags
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.LoadBattle
import Struct.Event
-import Struct.Flags
import Struct.Model
--------------------------------------------------------------------------------
diff --git a/src/battle/src/ElmModule/Subscriptions.elm b/src/battle/src/ElmModule/Subscriptions.elm
index fe276f4..c2b9fbe 100644
--- a/src/battle/src/ElmModule/Subscriptions.elm
+++ b/src/battle/src/ElmModule/Subscriptions.elm
@@ -1,8 +1,6 @@
module ElmModule.Subscriptions exposing (..)
--- Elm -------------------------------------------------------------------------
-
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
diff --git a/src/battle/src/ElmModule/Update.elm b/src/battle/src/ElmModule/Update.elm
index f9d7d38..ccf3e12 100644
--- a/src/battle/src/ElmModule/Update.elm
+++ b/src/battle/src/ElmModule/Update.elm
@@ -1,8 +1,6 @@
module ElmModule.Update exposing (update)
--- Elm -------------------------------------------------------------------------
-
--- Battle ----------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
@@ -34,7 +32,6 @@ import Update.UndoAction
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-
update : (
Struct.Event.Type ->
Struct.Model.Type ->
diff --git a/src/battle/src/ElmModule/View.elm b/src/battle/src/ElmModule/View.elm
index 3d3a6ba..243a98d 100644
--- a/src/battle/src/ElmModule/View.elm
+++ b/src/battle/src/ElmModule/View.elm
@@ -5,7 +5,7 @@ import Html
import Html.Lazy
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Constants.UI
import Struct.Event
diff --git a/src/battle/src/Main.elm b/src/battle/src/Main.elm
index e0dd884..bd497ba 100644
--- a/src/battle/src/Main.elm
+++ b/src/battle/src/Main.elm
@@ -1,10 +1,12 @@
-- Elm ------------------------------------------------------------------------
import Browser
--- Map -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Struct.Flags
+
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
-import Struct.Flags
import ElmModule.Init
import ElmModule.Subscriptions
diff --git a/src/battle/src/Struct/Armor.elm b/src/battle/src/Struct/Armor.elm
deleted file mode 100644
index 3043526..0000000
--- a/src/battle/src/Struct/Armor.elm
+++ /dev/null
@@ -1,70 +0,0 @@
-module Struct.Armor exposing
- (
- Type,
- Ref,
- new,
- get_id,
- get_name,
- get_image_id,
- get_omnimods,
- decoder,
- none
- )
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Battle ----------------------------------------------------------------------
-import Struct.Omnimods
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- id : String,
- name : String,
- omnimods : Struct.Omnimods.Type
- }
-
-type alias Ref = String
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-new : String -> String -> Struct.Omnimods.Type -> Type
-new id name omnimods =
- {
- id = id,
- name = name,
- omnimods = omnimods
- }
-
-get_id : Type -> Ref
-get_id ar = ar.id
-
-get_name : Type -> String
-get_name ar = ar.name
-
-get_image_id : Type -> String
-get_image_id ar = ar.id
-
-get_omnimods : Type -> Struct.Omnimods.Type
-get_omnimods ar = ar.omnimods
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.succeed
- Type
- |> (Json.Decode.Pipeline.required "id" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
- )
-
-none : Type
-none = (new "0" "None" (Struct.Omnimods.new [] [] [] []))
diff --git a/src/battle/src/Struct/Attack.elm b/src/battle/src/Struct/Attack.elm
index 377a413..a4937db 100644
--- a/src/battle/src/Struct/Attack.elm
+++ b/src/battle/src/Struct/Attack.elm
@@ -13,7 +13,7 @@ import Array
import Json.Decode
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
--------------------------------------------------------------------------------
diff --git a/src/battle/src/Struct/Attributes.elm b/src/battle/src/Struct/Attributes.elm
deleted file mode 100644
index ce871dd..0000000
--- a/src/battle/src/Struct/Attributes.elm
+++ /dev/null
@@ -1,173 +0,0 @@
-module Struct.Attributes exposing
- (
- Type,
- Category(..),
- get_constitution,
- get_dexterity,
- get_intelligence,
- get_mind,
- get_speed,
- get_strength,
- mod_constitution,
- mod_dexterity,
- mod_intelligence,
- mod_mind,
- mod_speed,
- mod_strength,
- mod,
- get,
- new,
- decode_category,
- default
- )
-
--- Elm -------------------------------------------------------------------------
-
--- Battle ----------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type Category =
- Constitution
- | Dexterity
- | Intelligence
- | Mind
- | Speed
- | Strength
-
-type alias Type =
- {
- constitution : Int,
- dexterity : Int,
- intelligence : Int,
- mind : Int,
- speed : Int,
- strength : Int
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_within_range : Int -> Int -> Int -> Int
-get_within_range vmin vmax v = (min vmax (max vmin v))
-
-get_within_att_range : Int -> Int
-get_within_att_range v = (get_within_range 0 100 v)
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_constitution : Type -> Int
-get_constitution t = t.constitution
-
-get_dexterity : Type -> Int
-get_dexterity t = t.dexterity
-
-get_intelligence : Type -> Int
-get_intelligence t = t.intelligence
-
-get_mind : Type -> Int
-get_mind t = t.mind
-
-get_speed : Type -> Int
-get_speed t = t.speed
-
-get_strength : Type -> Int
-get_strength t = t.strength
-
-mod_constitution : Int -> Type -> Type
-mod_constitution i t =
- {t |
- constitution = (get_within_att_range (i + t.constitution))
- }
-
-mod_dexterity : Int -> Type -> Type
-mod_dexterity i t =
- {t |
- dexterity = (get_within_att_range (i + t.dexterity))
- }
-
-mod_intelligence : Int -> Type -> Type
-mod_intelligence i t =
- {t |
- intelligence = (get_within_att_range (i + t.intelligence))
- }
-
-mod_mind : Int -> Type -> Type
-mod_mind i t =
- {t |
- mind = (get_within_att_range (i + t.mind))
- }
-
-mod_speed : Int -> Type -> Type
-mod_speed i t =
- {t |
- speed = (get_within_att_range (i + t.speed))
- }
-
-mod_strength : Int -> Type -> Type
-mod_strength i t =
- {t |
- strength = (get_within_att_range (i + t.strength))
- }
-
-mod : Category -> Int -> Type -> Type
-mod cat i t =
- case cat of
- Constitution -> (mod_constitution i t)
- Dexterity -> (mod_dexterity i t)
- Intelligence -> (mod_intelligence i t)
- Mind -> (mod_mind i t)
- Speed -> (mod_speed i t)
- Strength -> (mod_strength i t)
-
-get : Category -> Type -> Int
-get cat t =
- case cat of
- Constitution -> (get_constitution t)
- Dexterity -> (get_dexterity t)
- Intelligence -> (get_intelligence t)
- Mind -> (get_mind t)
- Speed -> (get_speed t)
- Strength -> (get_strength t)
-
-new : (
- Int -> -- constitution
- Int -> -- dexterity
- Int -> -- intelligence
- Int -> -- mind
- Int -> -- speed
- Int -> -- strength
- Type
- )
-new con dex int min spe str =
- {
- constitution = con,
- dexterity = dex,
- intelligence = int,
- mind = min,
- speed = spe,
- strength = str
- }
-
-default : Type
-default =
- {
- constitution = 50,
- dexterity = 50,
- intelligence = 50,
- mind = 50,
- speed = 50,
- strength = 50
- }
-
-decode_category : String -> Category
-decode_category str =
- case str of
- "con" -> Constitution
- "dex" -> Dexterity
- "int" -> Intelligence
- "min" -> Mind
- "spe" -> Speed
- _ -> Strength
diff --git a/src/battle/src/Struct/Character.elm b/src/battle/src/Struct/Character.elm
index 9259ec5..4e03082 100644
--- a/src/battle/src/Struct/Character.elm
+++ b/src/battle/src/Struct/Character.elm
@@ -22,8 +22,10 @@ module Struct.Character exposing
is_alive,
set_enabled,
set_defeated,
- get_weapons,
- set_weapons,
+ get_primary_weapon,
+ get_secondary_weapon,
+ toggle_is_using_primary,
+ get_is_using_primary,
decoder,
refresh_omnimods,
fill_missing_equipment_and_omnimods
@@ -33,15 +35,18 @@ module Struct.Character exposing
import Json.Decode
import Json.Decode.Pipeline
--- Map -------------------------------------------------------------------
-import Struct.Armor
-import Struct.Portrait
-import Struct.Attributes
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Attributes
+import Battle.Struct.Omnimods
+import Battle.Struct.Statistics
+
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Weapon
+
+-- Battle Map ------------------------------------------------------------------
import Struct.Location
-import Struct.Omnimods
-import Struct.Statistics
-import Struct.Weapon
-import Struct.WeaponSet
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -57,10 +62,10 @@ type alias PartiallyDecoded =
pla : Int,
ena : Bool,
dea : Bool,
- awp : Struct.Weapon.Ref,
- swp : Struct.Weapon.Ref,
- ar : Struct.Armor.Ref,
- omni : Struct.Omnimods.Type
+ awp : BattleCharacters.Struct.Weapon.Ref,
+ swp : BattleCharacters.Struct.Weapon.Ref,
+ ar : BattleCharacters.Struct.Armor.Ref,
+ omni : Battle.Struct.Omnimods.Type
}
@@ -74,18 +79,20 @@ type alias Type =
ix : Int,
name : String,
rank : Rank,
- portrait : Struct.Portrait.Type,
+ portrait : BattleCharacters.Struct.Portrait.Type,
location : Struct.Location.Type,
health : Int,
player_ix : Int,
enabled : Bool,
defeated : Bool,
- attributes : Struct.Attributes.Type,
- statistics : Struct.Statistics.Type,
- weapons : Struct.WeaponSet.Type,
- armor : Struct.Armor.Type,
- current_omnimods : Struct.Omnimods.Type,
- permanent_omnimods : Struct.Omnimods.Type
+ attributes : Battle.Struct.Attributes.Type,
+ statistics : Battle.Struct.Statistics.Type,
+ primary_weapon : BattleCharacters.Struct.Weapon.Type,
+ secondary_weapon : BattleCharacters.Struct.Weapon.Type,
+ is_using_primary : Bool,
+ armor : BattleCharacters.Struct.Armor.Type,
+ current_omnimods : Battle.Struct.Omnimods.Type,
+ permanent_omnimods : Battle.Struct.Omnimods.Type
}
type alias TypeAndEquipmentRef =
@@ -110,10 +117,9 @@ str_to_rank str =
finish_decoding : PartiallyDecoded -> TypeAndEquipmentRef
finish_decoding add_char =
let
- weapon_set = (Struct.WeaponSet.new Struct.Weapon.none Struct.Weapon.none)
- armor = Struct.Armor.none
- portrait = Struct.Portrait.none
- default_attributes = (Struct.Attributes.default)
+ armor = BattleCharacters.Struct.Armor.none
+ portrait = BattleCharacters.Struct.Portrait.none
+ default_attributes = (Battle.Struct.Attributes.default)
almost_char =
{
ix = add_char.ix,
@@ -123,13 +129,15 @@ finish_decoding add_char =
location = add_char.lc,
health = add_char.hea,
attributes = default_attributes,
- statistics = (Struct.Statistics.new_raw default_attributes),
+ statistics = (Battle.Struct.Statistics.new_raw default_attributes),
player_ix = add_char.pla,
enabled = add_char.ena,
defeated = add_char.dea,
- weapons = weapon_set,
+ primary_weapon = BattleCharacters.Struct.Weapon.none,
+ secondary_weapon = BattleCharacters.Struct.Weapon.none,
+ is_using_primary = True,
armor = armor,
- current_omnimods = (Struct.Omnimods.new [] [] [] []),
+ current_omnimods = (Battle.Struct.Omnimods.new [] [] [] []),
permanent_omnimods = add_char.omni
}
in
@@ -159,7 +167,7 @@ get_player_ix c = c.player_ix
get_current_health : Type -> Int
get_current_health c = c.health
-get_current_omnimods : Type -> Struct.Omnimods.Type
+get_current_omnimods : Type -> Battle.Struct.Omnimods.Type
get_current_omnimods c = c.current_omnimods
get_sane_current_health : Type -> Int
@@ -174,10 +182,10 @@ get_location t = t.location
set_location : Struct.Location.Type -> Type -> Type
set_location location char = {char | location = location}
-get_attributes : Type -> Struct.Attributes.Type
+get_attributes : Type -> Battle.Struct.Attributes.Type
get_attributes char = char.attributes
-get_statistics : Type -> Struct.Statistics.Type
+get_statistics : Type -> Battle.Struct.Statistics.Type
get_statistics char = char.statistics
is_alive : Type -> Bool
@@ -195,21 +203,25 @@ set_enabled enabled char = {char | enabled = enabled}
set_defeated : Bool -> Type -> Type
set_defeated defeated char = {char | defeated = defeated}
-get_weapons : Type -> Struct.WeaponSet.Type
-get_weapons char = char.weapons
+get_primary_weapon : Type -> BattleCharacters.Struct.Weapon.Type
+get_primary_weapon char = char.primary_weapon
+
+get_secondary_weapon : Type -> BattleCharacters.Struct.Weapon.Type
+get_secondary_weapon char = char.secondary_weapon
+
+get_is_using_primary : Type -> Bool
+get_is_using_primary char = char.is_using_primary
+
+toggle_is_using_primary : Type -> Type
+toggle_is_using_primary char =
+ {char | is_using_primary = (not char.is_using_primary)}
-get_armor : Type -> Struct.Armor.Type
+get_armor : Type -> BattleCharacters.Struct.Armor.Type
get_armor char = char.armor
-get_portrait : Type -> Struct.Portrait.Type
+get_portrait : Type -> BattleCharacters.Struct.Portrait.Type
get_portrait char = char.portrait
-set_weapons : Struct.WeaponSet.Type -> Type -> Type
-set_weapons weapons char =
- {char |
- weapons = weapons
- }
-
decoder : (Json.Decode.Decoder TypeAndEquipmentRef)
decoder =
(Json.Decode.map
@@ -228,39 +240,49 @@ decoder =
|> (Json.Decode.Pipeline.required "awp" Json.Decode.string)
|> (Json.Decode.Pipeline.required "swp" Json.Decode.string)
|> (Json.Decode.Pipeline.required "ar" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "pomni" Struct.Omnimods.decoder)
+ |>
+ (Json.Decode.Pipeline.required
+ "pomni"
+ Battle.Struct.Omnimods.decoder
+ )
)
)
refresh_omnimods : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ (Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
Type ->
Type
)
refresh_omnimods tile_omnimods_fun char =
let
- previous_max_health = (Struct.Statistics.get_max_health char.statistics)
+ previous_max_health =
+ (Battle.Struct.Statistics.get_max_health char.statistics)
current_omnimods =
- (Struct.Omnimods.merge
- (Struct.Weapon.get_omnimods
- (Struct.WeaponSet.get_active_weapon char.weapons)
+ (Battle.Struct.Omnimods.merge
+ (BattleCharacters.Struct.Weapon.get_omnimods
+ (
+ if (char.is_using_primary)
+ then char.primary_weapon
+ else char.secondary_weapon
+ )
)
- (Struct.Omnimods.merge
+ (Battle.Struct.Omnimods.merge
(tile_omnimods_fun char.location)
char.permanent_omnimods
)
)
current_attributes =
- (Struct.Omnimods.apply_to_attributes
+ (Battle.Struct.Omnimods.apply_to_attributes
current_omnimods
- (Struct.Attributes.default)
+ (Battle.Struct.Attributes.default)
)
current_statistics =
- (Struct.Omnimods.apply_to_statistics
+ (Battle.Struct.Omnimods.apply_to_statistics
current_omnimods
- (Struct.Statistics.new_raw current_attributes)
+ (Battle.Struct.Statistics.new_raw current_attributes)
)
- new_max_health = (Struct.Statistics.get_max_health current_statistics)
+ new_max_health =
+ (Battle.Struct.Statistics.get_max_health current_statistics)
in
{char |
attributes = current_attributes,
@@ -280,11 +302,11 @@ refresh_omnimods tile_omnimods_fun char =
}
fill_missing_equipment_and_omnimods : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
- Struct.Portrait.Type ->
- Struct.Weapon.Type ->
- Struct.Weapon.Type ->
- Struct.Armor.Type ->
+ (Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
+ BattleCharacters.Struct.Portrait.Type ->
+ BattleCharacters.Struct.Weapon.Type ->
+ BattleCharacters.Struct.Weapon.Type ->
+ BattleCharacters.Struct.Armor.Type ->
Type ->
Type
)
@@ -295,7 +317,8 @@ fill_missing_equipment_and_omnimods tile_omnimods_fun pt awp swp ar char =
(refresh_omnimods
(tile_omnimods_fun)
{char |
- weapons = (Struct.WeaponSet.new awp swp),
+ primary_weapon = awp,
+ secondary_weapon = swp,
armor = ar,
portrait = pt
}
diff --git a/src/battle/src/Struct/CharacterTurn.elm b/src/battle/src/Struct/CharacterTurn.elm
index d4cba5f..a017d23 100644
--- a/src/battle/src/Struct/CharacterTurn.elm
+++ b/src/battle/src/Struct/CharacterTurn.elm
@@ -25,11 +25,15 @@ module Struct.CharacterTurn exposing
import Json.Encode
-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Struct.Character
-import Struct.Direction
-import Struct.Location
import Struct.Navigator
-import Struct.Omnimods
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -45,7 +49,7 @@ type alias Type =
{
state : State,
active_character : (Maybe Struct.Character.Type),
- path : (List Struct.Direction.Type),
+ path : (List BattleMap.Struct.Direction.Type),
target : (Maybe Int),
navigator : (Maybe Struct.Navigator.Type),
has_switched_weapons : Bool
@@ -103,10 +107,14 @@ set_active_character_no_reset char ct =
get_state : Type -> State
get_state ct = ct.state
-get_path : Type -> (List Struct.Direction.Type)
+get_path : Type -> (List BattleMap.Struct.Direction.Type)
get_path ct = ct.path
-lock_path : (Struct.Location.Type -> Struct.Omnimods.Type) -> Type -> Type
+lock_path : (
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
+ Type ->
+ Type
+ )
lock_path tile_omnimods ct =
case (ct.navigator, ct.active_character) of
((Just old_nav), (Just char)) ->
@@ -131,7 +139,7 @@ lock_path tile_omnimods ct =
(_, _) ->
ct
-unlock_path : (Struct.Location.Type -> Struct.Omnimods.Type) -> Type -> Type
+unlock_path : (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) -> Type -> Type
unlock_path tile_omnimods ct =
case (ct.navigator, ct.active_character) of
((Just old_nav), (Just char)) ->
@@ -221,7 +229,7 @@ encode ct =
(
(Json.Encode.string)
<<
- (Struct.Direction.to_string)
+ (BattleMap.Struct.Direction.to_string)
)
(List.reverse (get_path ct))
)
diff --git a/src/battle/src/Struct/Event.elm b/src/battle/src/Struct/Event.elm
index 83f1e97..c03989f 100644
--- a/src/battle/src/Struct/Event.elm
+++ b/src/battle/src/Struct/Event.elm
@@ -3,10 +3,12 @@ module Struct.Event exposing (Type(..), attempted)
-- Elm -------------------------------------------------------------------------
import Http
--- Battle ----------------------------------------------------------------------
-import Struct.Direction
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Struct.Error
-import Struct.Location
import Struct.ServerReply
import Struct.HelpRequest
import Struct.UI
@@ -19,12 +21,12 @@ type Type =
| AnimationEnded
| AttackWithoutMovingRequest
| CharacterInfoRequested Int
- | CharacterOrTileSelected Struct.Location.Ref
+ | CharacterOrTileSelected BattleMap.Struct.Location.Ref
| CharacterSelected Int
| DebugLoadBattleRequest
| DebugTeamSwitchRequest
| DebugTestAnimation
- | DirectionRequested Struct.Direction.Type
+ | DirectionRequested BattleMap.Struct.Direction.Type
| Failed Struct.Error.Type
| GoToMainMenu
| LookingForCharacter Int
@@ -33,7 +35,7 @@ type Type =
| ScaleChangeRequested Float
| ServerReplied (Result Http.Error (List Struct.ServerReply.Type))
| TabSelected Struct.UI.Tab
- | TileSelected Struct.Location.Ref
+ | TileSelected BattleMap.Struct.Location.Ref
| TurnEnded
| UndoActionRequest
| WeaponSwitchRequest
diff --git a/src/battle/src/Struct/HelpRequest.elm b/src/battle/src/Struct/HelpRequest.elm
index a0693e2..42a28d6 100644
--- a/src/battle/src/Struct/HelpRequest.elm
+++ b/src/battle/src/Struct/HelpRequest.elm
@@ -2,7 +2,7 @@ module Struct.HelpRequest exposing (Type(..))
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
--------------------------------------------------------------------------------
diff --git a/src/battle/src/Struct/Map.elm b/src/battle/src/Struct/Map.elm
index 8bd39ad..c28f133 100644
--- a/src/battle/src/Struct/Map.elm
+++ b/src/battle/src/Struct/Map.elm
@@ -25,7 +25,7 @@ import Constants.Movement
import Struct.Character
import Struct.Location
-import Struct.Omnimods
+import Battle.Struct.Omnimods
import Struct.Tile
import Struct.TileInstance
import Struct.MapMarker
@@ -134,16 +134,16 @@ get_omnimods_at : (
Struct.Location.Type ->
(Dict.Dict Struct.Tile.Ref Struct.Tile.Type) ->
Type ->
- Struct.Omnimods.Type
+ Battle.Struct.Omnimods.Type
)
get_omnimods_at loc tiles_solver map =
case (try_getting_tile_at loc map) of
- Nothing -> (Struct.Omnimods.new [] [] [] [])
+ Nothing -> (Battle.Struct.Omnimods.new [] [] [] [])
(Just tile_inst) ->
case
(Dict.get (Struct.TileInstance.get_class_id tile_inst) tiles_solver)
of
- Nothing -> (Struct.Omnimods.new [] [] [] [])
+ Nothing -> (Battle.Struct.Omnimods.new [] [] [] [])
(Just tile) -> (Struct.Tile.get_omnimods tile)
solve_tiles : (Dict.Dict Struct.Tile.Ref Struct.Tile.Type) -> Type -> Type
diff --git a/src/battle/src/Struct/MapMarker.elm b/src/battle/src/Struct/MapMarker.elm
index 7b3e5e0..790ac1a 100644
--- a/src/battle/src/Struct/MapMarker.elm
+++ b/src/battle/src/Struct/MapMarker.elm
@@ -1,4 +1,4 @@
-module Struct.MapMarker exposing
+module BattleMap.Struct.MapMarker exposing
(
Type,
new,
@@ -14,8 +14,8 @@ import Json.Decode
import Json.Encode
import List
--- Battle ----------------------------------------------------------------------
-import Struct.Location
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -23,7 +23,7 @@ import Struct.Location
type alias Type =
{
permissions : (Set.Set String),
- locations : (Set.Set Struct.Location.Ref)
+ locations : (Set.Set BattleMap.Struct.Location.Ref)
}
--------------------------------------------------------------------------------
@@ -41,10 +41,10 @@ new =
locations = (Set.empty)
}
-get_locations : Type -> (Set.Set Struct.Location.Ref)
+get_locations : Type -> (Set.Set BattleMap.Struct.Location.Ref)
get_locations marker = marker.locations
-is_in_locations : Struct.Location.Ref -> Type -> Bool
+is_in_locations : BattleMap.Struct.Location.Ref -> Type -> Bool
is_in_locations loc_ref marker =
(Set.member loc_ref marker.locations)
@@ -65,8 +65,8 @@ decoder =
(Set.fromList)
(Json.Decode.list
(Json.Decode.map
- (Struct.Location.get_ref)
- (Struct.Location.decoder)
+ (BattleMap.Struct.Location.get_ref)
+ (BattleMap.Struct.Location.decoder)
)
)
)
@@ -88,7 +88,9 @@ encode marker =
"l",
(Json.Encode.list
(\e ->
- (Struct.Location.encode (Struct.Location.from_ref e))
+ (BattleMap.Struct.Location.encode
+ (BattleMap.Struct.Location.from_ref e)
+ )
)
(Set.toList marker.locations)
)
diff --git a/src/battle/src/Struct/Model.elm b/src/battle/src/Struct/Model.elm
index b45c445..b65ffb5 100644
--- a/src/battle/src/Struct/Model.elm
+++ b/src/battle/src/Struct/Model.elm
@@ -29,21 +29,27 @@ import Dict
import Struct.Flags
-- Battle ----------------------------------------------------------------------
-import Struct.Armor
+import Battle.Struct.Omnimods
+
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Weapon
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
import Struct.HelpRequest
-import Struct.Location
-import Struct.Map
-import Struct.Omnimods
-import Struct.Portrait
-import Struct.Tile
import Struct.TurnResult
import Struct.TurnResultAnimator
import Struct.Player
import Struct.UI
-import Struct.Weapon
import Util.Array
@@ -52,24 +58,36 @@ import Util.Array
--------------------------------------------------------------------------------
type alias Type =
{
- flags: Struct.Flags.Type,
- help_request: Struct.HelpRequest.Type,
- animator: (Maybe Struct.TurnResultAnimator.Type),
- map: Struct.Map.Type,
- characters: (Array.Array Struct.Character.Type),
- players: (Array.Array Struct.Player.Type),
- weapons: (Dict.Dict Struct.Weapon.Ref Struct.Weapon.Type),
- armors: (Dict.Dict Struct.Armor.Ref Struct.Armor.Type),
- portraits: (Dict.Dict Struct.Portrait.Ref Struct.Portrait.Type),
- tiles: (Dict.Dict Struct.Tile.Ref Struct.Tile.Type),
- error: (Maybe Struct.Error.Type),
- player_id: String,
- battle_id: String,
- session_token: String,
- player_ix: Int,
- ui: Struct.UI.Type,
- char_turn: Struct.CharacterTurn.Type,
- timeline: (Array.Array Struct.TurnResult.Type)
+ flags : Struct.Flags.Type,
+ help_request : Struct.HelpRequest.Type,
+ animator : (Maybe Struct.TurnResultAnimator.Type),
+ map : BattleMap.Struct.Map.Type,
+ characters : (Array.Array Struct.Character.Type),
+ players : (Array.Array Struct.Player.Type),
+ weapons :
+ (Dict.Dict
+ BattleCharacters.Struct.Weapon.Ref
+ BattleCharacters.Struct.Weapon.Type
+ ),
+ armors :
+ (Dict.Dict
+ BattleCharacters.Struct.Armor.Ref
+ BattleCharacters.Struct.Armor.Type
+ ),
+ portraits :
+ (Dict.Dict
+ BattleCharacters.Struct.Portrait.Ref
+ BattleCharacters.Struct.Portrait.Type
+ ),
+ tiles : (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type),
+ error : (Maybe Struct.Error.Type),
+ player_id : String,
+ battle_id : String,
+ session_token : String,
+ player_ix : Int,
+ ui : Struct.UI.Type,
+ char_turn : Struct.CharacterTurn.Type,
+ timeline : (Array.Array Struct.TurnResult.Type)
}
--------------------------------------------------------------------------------
@@ -79,9 +97,12 @@ type alias Type =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-tile_omnimods_fun : Type -> (Struct.Location.Type -> Struct.Omnimods.Type)
+tile_omnimods_fun : (
+ Type ->
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type)
+ )
tile_omnimods_fun model =
- (\loc -> (Struct.Map.get_omnimods_at loc model.tiles model.map))
+ (\loc -> (BattleMap.Struct.Map.get_omnimods_at loc model.tiles model.map))
new : Struct.Flags.Type -> Type
new flags =
@@ -92,7 +113,7 @@ new flags =
flags = flags,
help_request = Struct.HelpRequest.None,
animator = Nothing,
- map = (Struct.Map.empty),
+ map = (BattleMap.Struct.Map.empty),
characters = (Array.empty),
weapons = (Dict.empty),
armors = (Dict.empty),
@@ -136,34 +157,34 @@ add_character char model =
)
}
-add_weapon : Struct.Weapon.Type -> Type -> Type
+add_weapon : BattleCharacters.Struct.Weapon.Type -> Type -> Type
add_weapon wp model =
{model |
weapons =
(Dict.insert
- (Struct.Weapon.get_id wp)
+ (BattleCharacters.Struct.Weapon.get_id wp)
wp
model.weapons
)
}
-add_armor : Struct.Armor.Type -> Type -> Type
+add_armor : BattleCharacters.Struct.Armor.Type -> Type -> Type
add_armor ar model =
{model |
armors =
(Dict.insert
- (Struct.Armor.get_id ar)
+ (BattleCharacters.Struct.Armor.get_id ar)
ar
model.armors
)
}
-add_portrait : Struct.Portrait.Type -> Type -> Type
+add_portrait : BattleCharacters.Struct.Portrait.Type -> Type -> Type
add_portrait pt model =
{model |
portraits =
(Dict.insert
- (Struct.Portrait.get_id pt)
+ (BattleCharacters.Struct.Portrait.get_id pt)
pt
model.portraits
)
@@ -179,12 +200,12 @@ add_player pl model =
)
}
-add_tile : Struct.Tile.Type -> Type -> Type
+add_tile : BattleMap.Struct.Tile.Type -> Type -> Type
add_tile tl model =
{model |
tiles =
(Dict.insert
- (Struct.Tile.get_id tl)
+ (BattleMap.Struct.Tile.get_id tl)
tl
model.tiles
)
@@ -207,7 +228,7 @@ full_debug_reset model =
{model |
help_request = Struct.HelpRequest.None,
animator = Nothing,
- map = (Struct.Map.empty),
+ map = (BattleMap.Struct.Map.empty),
characters = (Array.empty),
weapons = (Dict.empty),
armors = (Dict.empty),
diff --git a/src/battle/src/Struct/Navigator.elm b/src/battle/src/Struct/Navigator.elm
index 41a60ef..f639a06 100644
--- a/src/battle/src/Struct/Navigator.elm
+++ b/src/battle/src/Struct/Navigator.elm
@@ -20,9 +20,11 @@ module Struct.Navigator exposing
-- Elm -------------------------------------------------------------------------
import Dict
--- Battle ----------------------------------------------------------------------
-import Struct.Location
-import Struct.Direction
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Direction
+
+-- Local Module ----------------------------------------------------------------
import Struct.Marker
import Struct.Path
import Struct.RangeIndicator
@@ -32,7 +34,7 @@ import Struct.RangeIndicator
--------------------------------------------------------------------------------
type alias Type =
{
- starting_location: Struct.Location.Type,
+ starting_location: BattleMap.Struct.Location.Type,
movement_dist: Int,
defense_dist: Int,
attack_dist: Int,
@@ -40,17 +42,17 @@ type alias Type =
locked_path: Bool,
range_indicators:
(Dict.Dict
- Struct.Location.Ref
+ BattleMap.Struct.Location.Ref
Struct.RangeIndicator.Type
),
- cost_fun: (Struct.Location.Type -> Int)
+ cost_fun: (BattleMap.Struct.Location.Type -> Int)
}
type alias Summary =
{
- starting_location: Struct.Location.Type,
- path: (List Struct.Direction.Type),
- markers: (List (Struct.Location.Ref, Struct.Marker.Type)),
+ starting_location: BattleMap.Struct.Location.Type,
+ path: (List BattleMap.Struct.Direction.Type),
+ markers: (List (BattleMap.Struct.Location.Ref, Struct.Marker.Type)),
locked_path: Bool
}
@@ -62,11 +64,11 @@ type alias Summary =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
new : (
- Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
Int ->
Int ->
Int ->
- (Struct.Location.Type -> Int) ->
+ (BattleMap.Struct.Location.Type -> Int) ->
Type
)
new start_loc mov_dist def_dist atk_dist cost_fun =
@@ -88,11 +90,11 @@ new start_loc mov_dist def_dist atk_dist cost_fun =
cost_fun = cost_fun
}
-get_current_location : Type -> Struct.Location.Type
+get_current_location : Type -> BattleMap.Struct.Location.Type
get_current_location navigator =
(Struct.Path.get_current_location navigator.path)
-get_starting_location : Type -> Struct.Location.Type
+get_starting_location : Type -> BattleMap.Struct.Location.Type
get_starting_location navigator = navigator.starting_location
get_remaining_points : Type -> Int
@@ -102,12 +104,12 @@ get_remaining_points navigator =
get_range_markers : (
Type ->
(List
- (Struct.Location.Ref, Struct.RangeIndicator.Type)
+ (BattleMap.Struct.Location.Ref, Struct.RangeIndicator.Type)
)
)
get_range_markers navigator = (Dict.toList navigator.range_indicators)
-get_path : Type -> (List Struct.Direction.Type)
+get_path : Type -> (List BattleMap.Struct.Direction.Type)
get_path navigator = (Struct.Path.get_summary navigator.path)
get_summary : Type -> Summary
@@ -189,7 +191,7 @@ lock_path_with_new_attack_ranges range_min range_max navigator =
}
try_adding_step : (
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
Type ->
(Maybe Type)
)
@@ -209,9 +211,9 @@ try_adding_step dir navigator =
Nothing -> Nothing
try_getting_path_to : (
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
Type ->
- (Maybe (List Struct.Direction.Type))
+ (Maybe (List BattleMap.Struct.Direction.Type))
)
try_getting_path_to loc_ref navigator =
case (Dict.get loc_ref navigator.range_indicators) of
diff --git a/src/battle/src/Struct/Path.elm b/src/battle/src/Struct/Path.elm
index b1a92ce..33cc618 100644
--- a/src/battle/src/Struct/Path.elm
+++ b/src/battle/src/Struct/Path.elm
@@ -11,12 +11,14 @@ module Struct.Path exposing
-- Elm -------------------------------------------------------------------------
import Set
--- Map -------------------------------------------------------------------
-import Struct.Direction
-import Struct.Location
-
+-- Shared ----------------------------------------------------------------------
import Util.List
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Constants.Movement
--------------------------------------------------------------------------------
@@ -24,9 +26,9 @@ import Constants.Movement
--------------------------------------------------------------------------------
type alias Type =
{
- current_location : Struct.Location.Type,
- visited_locations : (Set.Set Struct.Location.Ref),
- previous_directions : (List Struct.Direction.Type),
+ current_location : BattleMap.Struct.Location.Type,
+ visited_locations : (Set.Set BattleMap.Struct.Location.Ref),
+ previous_directions : (List BattleMap.Struct.Direction.Type),
previous_points : (List Int),
remaining_points : Int
}
@@ -36,7 +38,7 @@ type alias Type =
--------------------------------------------------------------------------------
has_been_to : (
Type ->
- Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
Bool
)
has_been_to path location =
@@ -44,15 +46,15 @@ has_been_to path location =
(path.current_location == location)
||
(Set.member
- (Struct.Location.get_ref location)
+ (BattleMap.Struct.Location.get_ref location)
path.visited_locations
)
)
try_moving_to : (
Type ->
- Struct.Direction.Type ->
- Struct.Location.Type ->
+ BattleMap.Struct.Direction.Type ->
+ BattleMap.Struct.Location.Type ->
Int ->
(Maybe Type)
)
@@ -67,7 +69,7 @@ try_moving_to path dir next_loc cost =
current_location = next_loc,
visited_locations =
(Set.insert
- (Struct.Location.get_ref path.current_location)
+ (BattleMap.Struct.Location.get_ref path.current_location)
path.visited_locations
),
previous_directions = (dir :: path.previous_directions),
@@ -81,8 +83,8 @@ try_moving_to path dir next_loc cost =
try_backtracking_to : (
Type ->
- Struct.Direction.Type ->
- Struct.Location.Type ->
+ BattleMap.Struct.Direction.Type ->
+ BattleMap.Struct.Location.Type ->
(Maybe Type)
)
try_backtracking_to path dir location =
@@ -97,14 +99,14 @@ try_backtracking_to path dir location =
(Just (prev_pts_head, prev_pts_tail))) ->
-- Does not compile in Elm 0.19 if I put the closing paren on this line
(
- if (prev_dir_head == (Struct.Direction.opposite_of dir))
+ if (prev_dir_head == (BattleMap.Struct.Direction.opposite_of dir))
then
(Just
{path |
current_location = location,
visited_locations =
(Set.remove
- (Struct.Location.get_ref location)
+ (BattleMap.Struct.Location.get_ref location)
path.visited_locations
),
previous_directions = prev_dir_tail,
@@ -123,7 +125,7 @@ try_backtracking_to path dir location =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-new : Struct.Location.Type -> Int -> Type
+new : BattleMap.Struct.Location.Type -> Int -> Type
new start points =
{
current_location = start,
@@ -133,19 +135,19 @@ new start points =
remaining_points = points
}
-get_current_location : Type -> Struct.Location.Type
+get_current_location : Type -> BattleMap.Struct.Location.Type
get_current_location path = path.current_location
get_remaining_points : Type -> Int
get_remaining_points path = path.remaining_points
-get_summary : Type -> (List Struct.Direction.Type)
+get_summary : Type -> (List BattleMap.Struct.Direction.Type)
get_summary path = path.previous_directions
try_following_direction : (
- (Struct.Location.Type -> Int) ->
+ (BattleMap.Struct.Location.Type -> Int) ->
(Maybe Type) ->
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
(Maybe Type)
)
try_following_direction cost_fun maybe_path dir =
@@ -153,7 +155,7 @@ try_following_direction cost_fun maybe_path dir =
(Just path) ->
let
next_location =
- (Struct.Location.neighbor
+ (BattleMap.Struct.Location.neighbor
dir
path.current_location
)
diff --git a/src/battle/src/Struct/Player.elm b/src/battle/src/Struct/Player.elm
index ee14ebe..33ce59b 100644
--- a/src/battle/src/Struct/Player.elm
+++ b/src/battle/src/Struct/Player.elm
@@ -15,8 +15,6 @@ module Struct.Player exposing
import Json.Decode
import Json.Decode.Pipeline
--- Battle ----------------------------------------------------------------------
-
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
diff --git a/src/battle/src/Struct/Portrait.elm b/src/battle/src/Struct/Portrait.elm
deleted file mode 100644
index 9d62d02..0000000
--- a/src/battle/src/Struct/Portrait.elm
+++ /dev/null
@@ -1,68 +0,0 @@
-module Struct.Portrait exposing
- (
- Type,
- Ref,
- none,
- get_id,
- get_name,
- get_body_id,
- get_icon_id,
- decoder
- )
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Battle ----------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- id : String,
- name : String,
- body_id : String,
- icon_id : String
- }
-
-type alias Ref = String
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-none : Type
-none =
- {
- id = "cat",
- name = "Black Cat",
- body_id = "mammal",
- icon_id = "cat"
- }
-
-get_id : Type -> String
-get_id p = p.id
-
-get_name : Type -> String
-get_name p = p.name
-
-get_body_id : Type -> String
-get_body_id p = p.body_id
-
-get_icon_id : Type -> String
-get_icon_id p = p.icon_id
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.succeed
- Type
- |> (Json.Decode.Pipeline.required "id" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "bid" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "iid" Json.Decode.string)
- )
diff --git a/src/battle/src/Struct/RangeIndicator.elm b/src/battle/src/Struct/RangeIndicator.elm
index 4669afd..5d960db 100644
--- a/src/battle/src/Struct/RangeIndicator.elm
+++ b/src/battle/src/Struct/RangeIndicator.elm
@@ -10,9 +10,11 @@ module Struct.RangeIndicator exposing
import Dict
import List
--- Map -------------------------------------------------------------------
-import Struct.Direction
-import Struct.Location
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Struct.Marker
import Constants.Movement
@@ -25,7 +27,7 @@ type alias Type =
distance: Int,
true_range: Int,
atk_range: Int,
- path: (List Struct.Direction.Type),
+ path: (List BattleMap.Struct.Direction.Type),
marker: Struct.Marker.Type
}
@@ -34,13 +36,13 @@ type alias SearchParameters =
maximum_distance: Int,
maximum_attack_range: Int,
minimum_defense_range: Int,
- cost_function: (Struct.Location.Type -> Int),
- true_range_fun: (Struct.Location.Type -> Int)
+ cost_function: (BattleMap.Struct.Location.Type -> Int),
+ true_range_fun: (BattleMap.Struct.Location.Type -> Int)
}
type alias LocatedIndicator =
{
- location_ref: Struct.Location.Ref,
+ location_ref: BattleMap.Struct.Location.Ref,
indicator: Type
}
--------------------------------------------------------------------------------
@@ -48,7 +50,7 @@ type alias LocatedIndicator =
--------------------------------------------------------------------------------
get_closest : (
Int ->
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
Type ->
LocatedIndicator ->
LocatedIndicator
@@ -80,8 +82,8 @@ is_closer max_dist candidate current =
generate_neighbor : (
SearchParameters ->
- Struct.Location.Type ->
- Struct.Direction.Type ->
+ BattleMap.Struct.Location.Type ->
+ BattleMap.Struct.Direction.Type ->
Type ->
(Int, Type)
)
@@ -145,9 +147,9 @@ candidate_is_acceptable search_params cost candidate =
candidate_is_an_improvement : (
SearchParameters ->
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
Type ->
- (Dict.Dict Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
Bool
)
candidate_is_an_improvement search_params loc_ref candidate alternatives =
@@ -160,17 +162,17 @@ candidate_is_an_improvement search_params loc_ref candidate alternatives =
handle_neighbors : (
LocatedIndicator ->
- (Dict.Dict Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
SearchParameters ->
- Struct.Direction.Type ->
- (Dict.Dict Struct.Location.Ref Type) ->
- (Dict.Dict Struct.Location.Ref Type)
+ BattleMap.Struct.Direction.Type ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type)
)
handle_neighbors src results search_params dir remaining =
let
- src_loc = (Struct.Location.from_ref src.location_ref)
- neighbor_loc = (Struct.Location.neighbor dir src_loc)
- neighbor_loc_ref = (Struct.Location.get_ref neighbor_loc)
+ src_loc = (BattleMap.Struct.Location.from_ref src.location_ref)
+ neighbor_loc = (BattleMap.Struct.Location.neighbor dir src_loc)
+ neighbor_loc_ref = (BattleMap.Struct.Location.get_ref neighbor_loc)
in
case (Dict.get neighbor_loc_ref results) of
(Just _) ->
@@ -209,7 +211,7 @@ handle_neighbors src results search_params dir remaining =
find_closest_in : (
SearchParameters ->
- (Dict.Dict Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
LocatedIndicator
)
find_closest_in search_params remaining =
@@ -247,8 +249,8 @@ resolve_marker_type search_params indicator =
insert_in_dictionary : (
LocatedIndicator ->
- (Dict.Dict Struct.Location.Ref Type) ->
- (Dict.Dict Struct.Location.Ref Type)
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type)
)
insert_in_dictionary located_indicator dict =
(Dict.insert
@@ -258,10 +260,10 @@ insert_in_dictionary located_indicator dict =
)
search : (
- (Dict.Dict Struct.Location.Ref Type) ->
- (Dict.Dict Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type) ->
SearchParameters ->
- (Dict.Dict Struct.Location.Ref Type)
+ (Dict.Dict BattleMap.Struct.Location.Ref Type)
)
search result remaining search_params =
if (Dict.isEmpty remaining)
@@ -289,10 +291,10 @@ search result remaining search_params =
)
(Dict.remove finalized_clos_loc_ind.location_ref remaining)
[
- Struct.Direction.Left,
- Struct.Direction.Right,
- Struct.Direction.Up,
- Struct.Direction.Down
+ BattleMap.Struct.Direction.Left,
+ BattleMap.Struct.Direction.Right,
+ BattleMap.Struct.Direction.Up,
+ BattleMap.Struct.Direction.Down
]
)
search_params
@@ -302,18 +304,18 @@ search result remaining search_params =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
generate : (
- Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
Int ->
Int ->
Int ->
- (Struct.Location.Type -> Int) ->
- (Dict.Dict Struct.Location.Ref Type)
+ (BattleMap.Struct.Location.Type -> Int) ->
+ (Dict.Dict BattleMap.Struct.Location.Ref Type)
)
generate location max_dist def_range atk_range cost_fun =
(search
Dict.empty
(Dict.insert
- (Struct.Location.get_ref location)
+ (BattleMap.Struct.Location.get_ref location)
{
distance = 0,
path = [],
@@ -333,12 +335,12 @@ generate location max_dist def_range atk_range cost_fun =
maximum_attack_range = atk_range,
minimum_defense_range = def_range,
cost_function = (cost_fun),
- true_range_fun = (Struct.Location.dist location)
+ true_range_fun = (BattleMap.Struct.Location.dist location)
}
)
get_marker : Type -> Struct.Marker.Type
get_marker indicator = indicator.marker
-get_path : Type -> (List Struct.Direction.Type)
+get_path : Type -> (List BattleMap.Struct.Direction.Type)
get_path indicator = indicator.path
diff --git a/src/battle/src/Struct/ServerReply.elm b/src/battle/src/Struct/ServerReply.elm
index b26a579..f8fdc88 100644
--- a/src/battle/src/Struct/ServerReply.elm
+++ b/src/battle/src/Struct/ServerReply.elm
@@ -1,31 +1,32 @@
module Struct.ServerReply exposing (Type(..))
--- Elm -------------------------------------------------------------------------
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Weapon
--- Battle ----------------------------------------------------------------------
-import Struct.Armor
-import Struct.Portrait
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Player
-import Struct.Map
import Struct.Character
-import Struct.Tile
import Struct.TurnResult
-import Struct.Weapon
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-
type Type =
Okay
| Disconnected
- | AddArmor Struct.Armor.Type
- | AddPortrait Struct.Portrait.Type
+ | AddArmor BattleCharacters.Struct.Armor.Type
+ | AddPortrait BattleCharacters.Struct.Portrait.Type
| AddPlayer Struct.Player.Type
- | AddWeapon Struct.Weapon.Type
+ | AddWeapon BattleCharacters.Struct.Weapon.Type
| AddCharacter Struct.Character.TypeAndEquipmentRef
- | AddTile Struct.Tile.Type
- | SetMap Struct.Map.Type
+ | AddTile BattleMap.Struct.Tile.Type
+ | SetMap BattleMap.Struct.Map.Type
| TurnResults (List Struct.TurnResult.Type)
| SetTimeline (List Struct.TurnResult.Type)
diff --git a/src/battle/src/Struct/TurnResult.elm b/src/battle/src/Struct/TurnResult.elm
index 36bf730..a4d3794 100644
--- a/src/battle/src/Struct/TurnResult.elm
+++ b/src/battle/src/Struct/TurnResult.elm
@@ -26,13 +26,16 @@ import Json.Decode
import Util.Array
-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Direction
+
+-- Local Module ----------------------------------------------------------------
import Struct.Attack
import Struct.Character
-import Struct.Direction
-import Struct.Location
-import Struct.Omnimods
import Struct.Player
-import Struct.WeaponSet
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -40,8 +43,8 @@ import Struct.WeaponSet
type alias Movement =
{
character_index : Int,
- path : (List Struct.Direction.Type),
- destination : Struct.Location.Type
+ path : (List BattleMap.Struct.Direction.Type),
+ destination : BattleMap.Struct.Location.Type
}
type alias Attack =
@@ -85,7 +88,7 @@ type Type =
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
apply_movement_step : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
Movement ->
(Array.Array Struct.Character.Type) ->
(Array.Array Struct.Player.Type) ->
@@ -102,7 +105,7 @@ apply_movement_step tile_omnimods movement characters players =
case (List.head movement.path) of
(Just dir) ->
(Struct.Character.set_location
- (Struct.Location.neighbor
+ (BattleMap.Struct.Location.neighbor
dir
(Struct.Character.get_location char)
)
@@ -118,7 +121,7 @@ apply_movement_step tile_omnimods movement characters players =
)
apply_inverse_movement_step : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
Movement ->
(Array.Array Struct.Character.Type) ->
(Array.Array Struct.Player.Type) ->
@@ -136,9 +139,9 @@ apply_inverse_movement_step tile_omnimods movement characters players =
(tile_omnimods)
(Struct.Character.set_location
(List.foldr
- (Struct.Location.neighbor)
+ (BattleMap.Struct.Location.neighbor)
(movement.destination)
- (List.map (Struct.Direction.opposite_of) movement.path)
+ (List.map (BattleMap.Struct.Direction.opposite_of) movement.path)
)
char
)
@@ -150,7 +153,7 @@ apply_inverse_movement_step tile_omnimods movement characters players =
)
apply_switched_weapon : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
WeaponSwitch ->
(Array.Array Struct.Character.Type) ->
(Array.Array Struct.Player.Type) ->
@@ -166,12 +169,7 @@ apply_switched_weapon tile_omnimods weapon_switch characters players =
(\char ->
(Struct.Character.refresh_omnimods
(tile_omnimods)
- (Struct.Character.set_weapons
- (Struct.WeaponSet.switch_weapons
- (Struct.Character.get_weapons char)
- )
- char
- )
+ (Struct.Character.toggle_is_using_primary char)
)
)
characters
@@ -290,8 +288,8 @@ movement_decoder =
(Json.Decode.map3
Movement
(Json.Decode.field "ix" Json.Decode.int)
- (Json.Decode.field "p" (Json.Decode.list (Struct.Direction.decoder)))
- (Json.Decode.field "nlc" (Struct.Location.decoder))
+ (Json.Decode.field "p" (Json.Decode.list (BattleMap.Struct.Direction.decoder)))
+ (Json.Decode.field "nlc" (BattleMap.Struct.Location.decoder))
)
attack_decoder : (Json.Decode.Decoder Attack)
@@ -441,7 +439,7 @@ apply_player_turn_started player_defeat characters players =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
apply_step : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
Type ->
(Array.Array Struct.Character.Type) ->
(Array.Array Struct.Player.Type) ->
@@ -476,7 +474,7 @@ apply_step tile_omnimods turn_result characters players =
(apply_player_turn_started pturns characters players)
apply_inverse_step : (
- (Struct.Location.Type -> Struct.Omnimods.Type) ->
+ (BattleMap.Struct.Location.Type -> Battle.Struct.Omnimods.Type) ->
Type ->
(Array.Array Struct.Character.Type) ->
(Array.Array Struct.Player.Type) ->
@@ -528,11 +526,11 @@ maybe_remove_step turn_result =
(PlayerLost pdefeat) -> Nothing
(PlayerTurnStarted pturns) -> Nothing
-get_next_movement_dir : Movement -> Struct.Direction.Type
+get_next_movement_dir : Movement -> BattleMap.Struct.Direction.Type
get_next_movement_dir movement =
case (List.head movement.path) of
(Just dir) -> dir
- Nothing -> Struct.Direction.None
+ Nothing -> BattleMap.Struct.Direction.None
get_attack_defender_index : Attack -> Int
get_attack_defender_index attack = attack.defender_index
diff --git a/src/battle/src/Struct/TurnResultAnimator.elm b/src/battle/src/Struct/TurnResultAnimator.elm
index 200938e..7f7938e 100644
--- a/src/battle/src/Struct/TurnResultAnimator.elm
+++ b/src/battle/src/Struct/TurnResultAnimator.elm
@@ -8,15 +8,12 @@ module Struct.TurnResultAnimator exposing
get_current_animation
)
--- Elm -------------------------------------------------------------------------
-
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.TurnResult
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-
type Animation =
Inactive
| AttackSetup (Int, Int)
diff --git a/src/battle/src/Struct/UI.elm b/src/battle/src/Struct/UI.elm
index 4837434..ddb92ca 100644
--- a/src/battle/src/Struct/UI.elm
+++ b/src/battle/src/Struct/UI.elm
@@ -25,8 +25,10 @@ module Struct.UI exposing
set_previous_action
)
--- Map -------------------------------------------------------------------
-import Struct.Location
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Struct.Navigator
--------------------------------------------------------------------------------
@@ -40,7 +42,7 @@ type Tab =
type Action =
UsedManualControls
- | SelectedLocation Struct.Location.Ref
+ | SelectedLocation BattleMap.Struct.Location.Ref
| SelectedCharacter Int
| AttackedCharacter Int
diff --git a/src/battle/src/Struct/Weapon.elm b/src/battle/src/Struct/Weapon.elm
deleted file mode 100644
index 21d80c5..0000000
--- a/src/battle/src/Struct/Weapon.elm
+++ /dev/null
@@ -1,99 +0,0 @@
-module Struct.Weapon exposing
- (
- Type,
- Ref,
- new,
- get_id,
- get_name,
- get_attack_range,
- get_defense_range,
- get_omnimods,
- get_damage_sum,
- decoder,
- none
- )
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Map -------------------------------------------------------------------
-import Struct.Omnimods
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias PartiallyDecoded =
- {
- id : String,
- nam : String,
- rmi : Int,
- rma : Int,
- omni : String
- }
-
-type alias Type =
- {
- id : String,
- name : String,
- def_range : Int,
- atk_range : Int,
- omnimods : Struct.Omnimods.Type,
- damage_sum : Int
- }
-
-type alias Ref = String
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-new : String -> String -> Int -> Int -> Struct.Omnimods.Type -> Type
-new id name range_min range_max omnimods =
- {
- id = id,
- name = name,
- def_range = range_min,
- atk_range = range_max,
- omnimods = omnimods,
- damage_sum = (Struct.Omnimods.get_damage_sum omnimods)
- }
-
-get_id : Type -> String
-get_id wp = wp.id
-
-get_name : Type -> String
-get_name wp = wp.name
-
-get_attack_range : Type -> Int
-get_attack_range wp = wp.atk_range
-
-get_defense_range : Type -> Int
-get_defense_range wp = wp.def_range
-
-get_omnimods : Type -> Struct.Omnimods.Type
-get_omnimods wp = wp.omnimods
-
-get_damage_sum : Type -> Int
-get_damage_sum wp = wp.damage_sum
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.map
- (\e -> {e | damage_sum = (Struct.Omnimods.get_damage_sum e.omnimods)})
- (Json.Decode.succeed
- Type
- |> (Json.Decode.Pipeline.required "id" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "rmi" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "rma" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
- |> (Json.Decode.Pipeline.hardcoded 0)
- )
- )
-
-none : Type
-none = (new "0" "None" 0 0 (Struct.Omnimods.new [] [] [] []))
diff --git a/src/battle/src/Struct/WeaponSet.elm b/src/battle/src/Struct/WeaponSet.elm
deleted file mode 100644
index de96daf..0000000
--- a/src/battle/src/Struct/WeaponSet.elm
+++ /dev/null
@@ -1,39 +0,0 @@
-module Struct.WeaponSet exposing
- (
- Type,
- new,
- get_active_weapon,
- get_secondary_weapon,
- switch_weapons
- )
-
--- Map -------------------------------------------------------------------
-import Struct.Weapon
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- active : Struct.Weapon.Type,
- secondary : Struct.Weapon.Type
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-new : Struct.Weapon.Type -> Struct.Weapon.Type -> Type
-new wp0 wp1 = { active = wp0, secondary = wp1 }
-
-get_active_weapon : Type -> Struct.Weapon.Type
-get_active_weapon set = set.active
-
-get_secondary_weapon : Type -> Struct.Weapon.Type
-get_secondary_weapon set = set.secondary
-
-switch_weapons : Type -> Type
-switch_weapons set = {set | active = set.secondary, secondary = set.active}
diff --git a/src/battle/src/Update/AbortTurn.elm b/src/battle/src/Update/AbortTurn.elm
index efffcff..486e846 100644
--- a/src/battle/src/Update/AbortTurn.elm
+++ b/src/battle/src/Update/AbortTurn.elm
@@ -1,8 +1,6 @@
module Update.AbortTurn exposing (apply_to)
--- Elm -------------------------------------------------------------------------
-
--- Struct.Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
diff --git a/src/battle/src/Update/AttackWithoutMoving.elm b/src/battle/src/Update/AttackWithoutMoving.elm
index 002fbc1..7d29a50 100644
--- a/src/battle/src/Update/AttackWithoutMoving.elm
+++ b/src/battle/src/Update/AttackWithoutMoving.elm
@@ -1,8 +1,6 @@
module Update.AttackWithoutMoving exposing (apply_to)
--- Elm -------------------------------------------------------------------------
-
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
import Struct.Error
import Struct.Event
@@ -24,10 +22,7 @@ make_it_so model =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : (
- Struct.Model.Type ->
- (Struct.Model.Type, (Cmd Struct.Event.Type))
- )
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
apply_to model =
case (Struct.CharacterTurn.get_state model.char_turn) of
Struct.CharacterTurn.SelectedCharacter ->
diff --git a/src/battle/src/Update/ChangeScale.elm b/src/battle/src/Update/ChangeScale.elm
index 69e98b4..80db1d1 100644
--- a/src/battle/src/Update/ChangeScale.elm
+++ b/src/battle/src/Update/ChangeScale.elm
@@ -1,7 +1,6 @@
module Update.ChangeScale exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.UI
diff --git a/src/battle/src/Update/DisplayCharacterInfo.elm b/src/battle/src/Update/DisplayCharacterInfo.elm
index e482e2f..46037fd 100644
--- a/src/battle/src/Update/DisplayCharacterInfo.elm
+++ b/src/battle/src/Update/DisplayCharacterInfo.elm
@@ -1,9 +1,10 @@
module Update.DisplayCharacterInfo exposing (apply_to)
+
-- Elm -------------------------------------------------------------------------
import Array
import Task
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Action.Scroll
import Struct.Character
diff --git a/src/battle/src/Update/EndTurn.elm b/src/battle/src/Update/EndTurn.elm
index 36c5869..b226452 100644
--- a/src/battle/src/Update/EndTurn.elm
+++ b/src/battle/src/Update/EndTurn.elm
@@ -1,8 +1,6 @@
module Update.EndTurn exposing (apply_to)
--- Elm -------------------------------------------------------------------------
-
--- Struct.Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.CharacterTurn
import Struct.Character
diff --git a/src/battle/src/Update/GoToMainMenu.elm b/src/battle/src/Update/GoToMainMenu.elm
index f2ec989..a0471f2 100644
--- a/src/battle/src/Update/GoToMainMenu.elm
+++ b/src/battle/src/Update/GoToMainMenu.elm
@@ -1,9 +1,9 @@
module Update.GoToMainMenu exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battle ----------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
import Action.Ports
+-- Local Module ----------------------------------------------------------------
import Constants.IO
import Struct.Model
diff --git a/src/battle/src/Update/HandleAnimationEnded.elm b/src/battle/src/Update/HandleAnimationEnded.elm
index 332d368..72801ed 100644
--- a/src/battle/src/Update/HandleAnimationEnded.elm
+++ b/src/battle/src/Update/HandleAnimationEnded.elm
@@ -9,7 +9,7 @@ import Time
import Task
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Action.Scroll
import Struct.Character
diff --git a/src/battle/src/Update/HandleServerReply.elm b/src/battle/src/Update/HandleServerReply.elm
index 6bdc0bc..8140ebd 100644
--- a/src/battle/src/Update/HandleServerReply.elm
+++ b/src/battle/src/Update/HandleServerReply.elm
@@ -20,23 +20,27 @@ import Struct.Flags
import Util.Http
--- Battle ----------------------------------------------------------------------
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Portrait
+import BattleCharacters.Struct.Weapon
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Constants.IO
-import Struct.Armor
import Struct.Player
import Struct.Character
import Struct.Error
import Struct.Event
-import Struct.Map
import Struct.Model
-import Struct.Portrait
import Struct.ServerReply
-import Struct.Tile
import Struct.TurnResult
import Struct.TurnResultAnimator
import Struct.UI
-import Struct.Weapon
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -45,27 +49,35 @@ import Struct.Weapon
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-weapon_getter : Struct.Model.Type -> Struct.Weapon.Ref -> Struct.Weapon.Type
+weapon_getter : (
+ Struct.Model.Type ->
+ BattleCharacters.Struct.Weapon.Ref ->
+ BattleCharacters.Struct.Weapon.Type
+ )
weapon_getter model ref =
case (Dict.get ref model.weapons) of
(Just w) -> w
- Nothing -> Struct.Weapon.none
+ Nothing -> BattleCharacters.Struct.Weapon.none
-armor_getter : Struct.Model.Type -> Struct.Armor.Ref -> Struct.Armor.Type
+armor_getter : (
+ Struct.Model.Type ->
+ BattleCharacters.Struct.Armor.Ref ->
+ BattleCharacters.Struct.Armor.Type
+ )
armor_getter model ref =
case (Dict.get ref model.armors) of
(Just w) -> w
- Nothing -> Struct.Armor.none
+ Nothing -> BattleCharacters.Struct.Armor.none
portrait_getter : (
Struct.Model.Type ->
- Struct.Portrait.Ref ->
- Struct.Portrait.Type
+ BattleCharacters.Struct.Portrait.Ref ->
+ BattleCharacters.Struct.Portrait.Type
)
portrait_getter model ref =
case (Dict.get ref model.portraits) of
(Just w) -> w
- Nothing -> Struct.Portrait.none
+ Nothing -> BattleCharacters.Struct.Portrait.none
-----------
@@ -95,7 +107,7 @@ disconnected current_state =
)
add_armor : (
- Struct.Armor.Type ->
+ BattleCharacters.Struct.Armor.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
@@ -104,7 +116,7 @@ add_armor ar current_state =
((Struct.Model.add_armor ar model), cmds)
add_portrait : (
- Struct.Portrait.Type ->
+ BattleCharacters.Struct.Portrait.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
@@ -113,7 +125,7 @@ add_portrait pt current_state =
((Struct.Model.add_portrait pt model), cmds)
add_tile : (
- Struct.Tile.Type ->
+ BattleMap.Struct.Tile.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
@@ -122,7 +134,7 @@ add_tile tl current_state =
((Struct.Model.add_tile tl model), cmds)
add_weapon : (
- Struct.Weapon.Type ->
+ BattleCharacters.Struct.Weapon.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
@@ -168,7 +180,7 @@ add_character char_and_refs current_state =
)
set_map : (
- Struct.Map.Type ->
+ BattleMap.Struct.Map.Type ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
(Struct.Model.Type, (List (Cmd Struct.Event.Type)))
)
@@ -176,7 +188,7 @@ set_map map current_state =
let (model, cmds) = current_state in
(
{model |
- map = (Struct.Map.solve_tiles model.tiles map)
+ map = (BattleMap.Struct.Map.solve_tiles model.tiles map)
},
cmds
)
diff --git a/src/battle/src/Update/LookForCharacter.elm b/src/battle/src/Update/LookForCharacter.elm
index 7057451..8e7efc7 100644
--- a/src/battle/src/Update/LookForCharacter.elm
+++ b/src/battle/src/Update/LookForCharacter.elm
@@ -1,9 +1,10 @@
module Update.LookForCharacter exposing (apply_to)
+
-- Elm -------------------------------------------------------------------------
import Array
import Task
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Action.Scroll
import Struct.Character
@@ -14,11 +15,7 @@ import Struct.UI
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-scroll_to_char : (
- Struct.Model.Type ->
- Int ->
- (Cmd Struct.Event.Type)
- )
+scroll_to_char : Struct.Model.Type -> Int -> (Cmd Struct.Event.Type)
scroll_to_char model char_ix =
case (Array.get char_ix model.characters) of
(Just char) ->
diff --git a/src/battle/src/Update/RequestDirection.elm b/src/battle/src/Update/RequestDirection.elm
index b6c8f13..625d8fe 100644
--- a/src/battle/src/Update/RequestDirection.elm
+++ b/src/battle/src/Update/RequestDirection.elm
@@ -1,10 +1,10 @@
module Update.RequestDirection exposing (apply_to)
--- Elm -------------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
-import Struct.Direction
import Struct.Error
import Struct.Event
import Struct.Model
@@ -17,7 +17,7 @@ import Struct.UI
make_it_so : (
Struct.Model.Type ->
Struct.Navigator.Type ->
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
Struct.Model.Type
)
make_it_so model navigator dir =
@@ -50,7 +50,7 @@ make_it_so model navigator dir =
--------------------------------------------------------------------------------
apply_to : (
Struct.Model.Type ->
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model dir =
diff --git a/src/battle/src/Update/SelectCharacter.elm b/src/battle/src/Update/SelectCharacter.elm
index 169046c..2b70f1c 100644
--- a/src/battle/src/Update/SelectCharacter.elm
+++ b/src/battle/src/Update/SelectCharacter.elm
@@ -5,21 +5,26 @@ import Array
import Task
--- Map -------------------------------------------------------------------
-import Action.Scroll
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Statistics
+
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Weapon
+-- Battle Map ------------------------------------------------------------------
import Struct.Map
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
+import Action.Scroll
+
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
import Struct.Event
-import Struct.Location
import Struct.Model
import Struct.Navigator
-import Struct.Statistics
import Struct.UI
-import Struct.Weapon
-import Struct.WeaponSet
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -32,17 +37,19 @@ get_character_navigator : (
get_character_navigator model char =
let
weapon =
- (Struct.WeaponSet.get_active_weapon
- (Struct.Character.get_weapons char)
+ (
+ if (Struct.Character.get_is_using_primary char)
+ then (Struct.Character.get_primary_weapon char)
+ else (Struct.Character.get_secondary_weapon char)
)
in
(Struct.Navigator.new
(Struct.Character.get_location char)
- (Struct.Statistics.get_movement_points
+ (Battle.Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
- (Struct.Weapon.get_defense_range weapon)
- (Struct.Weapon.get_attack_range weapon)
+ (BattleCharacters.Struct.Weapon.get_defense_range weapon)
+ (BattleCharacters.Struct.Weapon.get_attack_range weapon)
(Struct.Map.get_movement_cost_function
model.map
(Struct.Character.get_location char)
@@ -135,7 +142,7 @@ can_target_character model target =
(Just nav) ->
case
(Struct.Navigator.try_getting_path_to
- (Struct.Location.get_ref
+ (BattleMap.Struct.Location.get_ref
(Struct.Character.get_location target)
)
nav
diff --git a/src/battle/src/Update/SelectCharacterOrTile.elm b/src/battle/src/Update/SelectCharacterOrTile.elm
index 4028d8e..7c7994f 100644
--- a/src/battle/src/Update/SelectCharacterOrTile.elm
+++ b/src/battle/src/Update/SelectCharacterOrTile.elm
@@ -1,18 +1,19 @@
module Update.SelectCharacterOrTile exposing (apply_to)
--- Elm -------------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.Array
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
-import Struct.Location
import Struct.Model
import Update.SelectCharacter
import Update.SelectTile
-import Util.Array
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
@@ -22,7 +23,7 @@ import Util.Array
--------------------------------------------------------------------------------
apply_to : (
Struct.Model.Type ->
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model loc_ref =
@@ -32,7 +33,7 @@ apply_to model loc_ref =
(
(
(Struct.Character.get_location c)
- == (Struct.Location.from_ref loc_ref)
+ == (BattleMap.Struct.Location.from_ref loc_ref)
)
&&
(Struct.Character.is_alive c)
diff --git a/src/battle/src/Update/SelectTab.elm b/src/battle/src/Update/SelectTab.elm
index d15a463..2a41303 100644
--- a/src/battle/src/Update/SelectTab.elm
+++ b/src/battle/src/Update/SelectTab.elm
@@ -1,7 +1,6 @@
module Update.SelectTab exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
import Struct.UI
diff --git a/src/battle/src/Update/SelectTile.elm b/src/battle/src/Update/SelectTile.elm
index 64cee2f..575ac13 100644
--- a/src/battle/src/Update/SelectTile.elm
+++ b/src/battle/src/Update/SelectTile.elm
@@ -1,13 +1,13 @@
module Update.SelectTile exposing (apply_to)
--- Elm -------------------------------------------------------------------------
+-- Battle Map -------------------------------------------------------------------
+import BattleMap.Struct.Direction
+import BattleMap.Struct.Location
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
-import Struct.Direction
import Struct.Error
import Struct.Event
-import Struct.Location
import Struct.Model
import Struct.Navigator
import Struct.UI
@@ -16,7 +16,7 @@ import Struct.UI
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
try_autopiloting : (
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
(Maybe Struct.Navigator.Type) ->
(Maybe Struct.Navigator.Type)
)
@@ -30,7 +30,7 @@ try_autopiloting dir maybe_nav =
go_to_tile : (
Struct.Model.Type ->
Struct.Navigator.Type ->
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
go_to_tile model navigator loc_ref =
@@ -38,7 +38,7 @@ go_to_tile model navigator loc_ref =
(
loc_ref
==
- (Struct.Location.get_ref
+ (BattleMap.Struct.Location.get_ref
(Struct.Navigator.get_current_location navigator)
)
)
@@ -135,7 +135,7 @@ go_to_tile model navigator loc_ref =
--------------------------------------------------------------------------------
apply_to : (
Struct.Model.Type ->
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model loc_ref =
diff --git a/src/battle/src/Update/SendLoadBattleRequest.elm b/src/battle/src/Update/SendLoadBattleRequest.elm
index 9d8905c..e463954 100644
--- a/src/battle/src/Update/SendLoadBattleRequest.elm
+++ b/src/battle/src/Update/SendLoadBattleRequest.elm
@@ -1,7 +1,6 @@
module Update.SendLoadBattleRequest exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.LoadBattle
import Struct.Event
@@ -14,10 +13,7 @@ import Struct.Model
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : (
- Struct.Model.Type ->
- (Struct.Model.Type, (Cmd Struct.Event.Type))
- )
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
apply_to model =
(
(Struct.Model.full_debug_reset model),
diff --git a/src/battle/src/Update/SetRequestedHelp.elm b/src/battle/src/Update/SetRequestedHelp.elm
index dfc58db..45e5e93 100644
--- a/src/battle/src/Update/SetRequestedHelp.elm
+++ b/src/battle/src/Update/SetRequestedHelp.elm
@@ -1,7 +1,6 @@
module Update.SetRequestedHelp exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.HelpRequest
import Struct.Model
diff --git a/src/battle/src/Update/SwitchTeam.elm b/src/battle/src/Update/SwitchTeam.elm
index 4e415be..85224ac 100644
--- a/src/battle/src/Update/SwitchTeam.elm
+++ b/src/battle/src/Update/SwitchTeam.elm
@@ -1,7 +1,6 @@
module Update.SwitchTeam exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
@@ -12,10 +11,7 @@ import Struct.Event
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : (
- Struct.Model.Type ->
- (Struct.Model.Type, (Cmd Struct.Event.Type))
- )
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
apply_to model =
if (model.player_ix == 0)
then
diff --git a/src/battle/src/Update/SwitchWeapon.elm b/src/battle/src/Update/SwitchWeapon.elm
index 5e81f4c..33031f2 100644
--- a/src/battle/src/Update/SwitchWeapon.elm
+++ b/src/battle/src/Update/SwitchWeapon.elm
@@ -1,16 +1,17 @@
module Update.SwitchWeapon exposing (apply_to)
--- Elm -------------------------------------------------------------------------
+-- FIXME: switching weapon should make the navigator disappear.
--- Battle ----------------------------------------------------------------------
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Weapon
+
+-- Local module ----------------------------------------------------------------
import Struct.Character
import Struct.CharacterTurn
import Struct.Error
import Struct.Event
import Struct.Model
import Struct.Navigator
-import Struct.Weapon
-import Struct.WeaponSet
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -28,11 +29,6 @@ make_it_so model =
tile_omnimods = (Struct.Model.tile_omnimods_fun model)
current_tile_omnimods =
(tile_omnimods (Struct.Navigator.get_current_location nav))
- new_weapons =
- (Struct.WeaponSet.switch_weapons
- (Struct.Character.get_weapons char)
- )
- new_main_weapon = (Struct.WeaponSet.get_active_weapon new_weapons)
new_char =
(Struct.Character.refresh_omnimods
(\e -> current_tile_omnimods)
@@ -43,13 +39,9 @@ make_it_so model =
char_turn =
(Struct.CharacterTurn.set_has_switched_weapons
True
- (Struct.CharacterTurn.show_attack_range_navigator
- (Struct.Weapon.get_defense_range new_main_weapon)
- (Struct.Weapon.get_attack_range new_main_weapon)
- (Struct.CharacterTurn.set_active_character_no_reset
- new_char
- model.char_turn
- )
+ (Struct.CharacterTurn.set_active_character_no_reset
+ new_char
+ model.char_turn
)
)
}
diff --git a/src/battle/src/Update/TestAnimation.elm b/src/battle/src/Update/TestAnimation.elm
index a2fec9a..36e2c04 100644
--- a/src/battle/src/Update/TestAnimation.elm
+++ b/src/battle/src/Update/TestAnimation.elm
@@ -5,7 +5,7 @@ import Delay
import Time
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
@@ -16,10 +16,7 @@ import Struct.Event
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-apply_to : (
- Struct.Model.Type ->
- (Struct.Model.Type, (Cmd Struct.Event.Type))
- )
+apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type))
apply_to model =
(
(Struct.Model.initialize_animator model),
diff --git a/src/battle/src/Update/UndoAction.elm b/src/battle/src/Update/UndoAction.elm
index e422bca..cd3ab41 100644
--- a/src/battle/src/Update/UndoAction.elm
+++ b/src/battle/src/Update/UndoAction.elm
@@ -4,15 +4,20 @@ module Update.UndoAction exposing (apply_to)
import Array
-- Battle ----------------------------------------------------------------------
-import Struct.Map
+import Battle.Struct.Statistics
+
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Weapon
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
import Struct.Navigator
-import Struct.Statistics
-import Struct.Weapon
-import Struct.WeaponSet
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -25,18 +30,20 @@ get_character_navigator : (
get_character_navigator model char =
let
weapon =
- (Struct.WeaponSet.get_active_weapon
- (Struct.Character.get_weapons char)
+ (
+ if (Struct.Character.get_is_using_primary char)
+ then (Struct.Character.get_primary_weapon char)
+ else (Struct.Character.get_secondary_weapon char)
)
in
(Struct.Navigator.new
(Struct.Character.get_location char)
- (Struct.Statistics.get_movement_points
+ (Battle.Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
- (Struct.Weapon.get_defense_range weapon)
- (Struct.Weapon.get_attack_range weapon)
- (Struct.Map.get_movement_cost_function
+ (BattleCharacters.Struct.Weapon.get_defense_range weapon)
+ (BattleCharacters.Struct.Weapon.get_attack_range weapon)
+ (BattleMap.Struct.Map.get_movement_cost_function
model.map
(Struct.Character.get_location char)
(Array.toList model.characters)
@@ -73,12 +80,7 @@ handle_undo_switched_weapons model =
(Just char) ->
let
- new_weapons =
- (Struct.WeaponSet.switch_weapons
- (Struct.Character.get_weapons char)
- )
- new_char =
- (Struct.Character.set_weapons new_weapons char)
+ new_char = (Struct.Character.toggle_is_using_primary char)
tile_omnimods = (Struct.Model.tile_omnimods_fun model)
in
(Struct.CharacterTurn.lock_path
diff --git a/src/battle/src/View/Character.elm b/src/battle/src/View/Character.elm
index 49de74b..e65f947 100644
--- a/src/battle/src/View/Character.elm
+++ b/src/battle/src/View/Character.elm
@@ -9,17 +9,20 @@ import Html
import Html.Attributes
import Html.Events
--- Map ------------------------------------------------------------------
-import Constants.UI
-
+-- Shared ----------------------------------------------------------------------
import Util.Html
-import Struct.Armor
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Portrait
+
+-- Local Module ----------------------------------------------------------------
+import Constants.UI
+
import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
-import Struct.Portrait
import Struct.UI
--------------------------------------------------------------------------------
@@ -116,7 +119,7 @@ get_icon_head_html char =
(
"asset-character-icon-"
++
- (Struct.Portrait.get_icon_id
+ (BattleCharacters.Struct.Portrait.get_icon_id
(Struct.Character.get_portrait char)
)
)
@@ -163,7 +166,10 @@ get_portrait_body_html char =
(Html.Attributes.class
(
"asset-character-portrait-"
- ++ (Struct.Portrait.get_id (Struct.Character.get_portrait char))
+ ++
+ (BattleCharacters.Struct.Portrait.get_id
+ (Struct.Character.get_portrait char)
+ )
)
)
]
@@ -180,14 +186,16 @@ get_portrait_armor_html char =
(
"asset-armor-"
++
- (Struct.Armor.get_image_id (Struct.Character.get_armor char))
+ (BattleCharacters.Struct.Armor.get_image_id
+ (Struct.Character.get_armor char)
+ )
)
),
(Html.Attributes.class
(
"asset-armor-variation-"
++
- (Struct.Portrait.get_body_id
+ (BattleCharacters.Struct.Portrait.get_body_id
(Struct.Character.get_portrait char)
)
)
diff --git a/src/battle/src/View/Controlled.elm b/src/battle/src/View/Controlled.elm
index cb71842..003ec34 100644
--- a/src/battle/src/View/Controlled.elm
+++ b/src/battle/src/View/Controlled.elm
@@ -5,13 +5,14 @@ import Html
import Html.Attributes
import Html.Events
--- Struct.Map -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
import Struct.Event
import Struct.Navigator
-import Util.Html
-
import View.Controlled.CharacterCard
import View.Controlled.ManualControls
diff --git a/src/battle/src/View/Controlled/CharacterCard.elm b/src/battle/src/View/Controlled/CharacterCard.elm
index b9874f5..0ece1fa 100644
--- a/src/battle/src/View/Controlled/CharacterCard.elm
+++ b/src/battle/src/View/Controlled/CharacterCard.elm
@@ -12,19 +12,23 @@ import Html
import Html.Attributes
import Html.Events
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
-- Battle ----------------------------------------------------------------------
-import Struct.Armor
+import Battle.Struct.Omnimods
+import Battle.Struct.Statistics
+
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Armor
+import BattleCharacters.Struct.Weapon
+
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.HelpRequest
import Struct.Navigator
-import Struct.Omnimods
-import Struct.Statistics
-import Struct.Weapon
-import Struct.WeaponSet
-
-import Util.Html
import View.Character
import View.Gauge
@@ -56,7 +60,7 @@ get_health_bar char =
let
current = (Struct.Character.get_sane_current_health char)
max =
- (Struct.Statistics.get_max_health
+ (Battle.Struct.Statistics.get_max_health
(Struct.Character.get_statistics char)
)
in
@@ -68,10 +72,7 @@ get_health_bar char =
[]
)
-get_rank_status : (
- Struct.Character.Rank ->
- (Html.Html Struct.Event.Type)
- )
+get_rank_status : Struct.Character.Rank -> (Html.Html Struct.Event.Type)
get_rank_status rank =
(Html.div
[
@@ -97,10 +98,7 @@ get_rank_status rank =
]
)
-get_statuses : (
- Struct.Character.Type ->
- (Html.Html Struct.Event.Type)
- )
+get_statuses : Struct.Character.Type -> (Html.Html Struct.Event.Type)
get_statuses char =
(Html.div
[
@@ -123,7 +121,7 @@ get_active_movement_bar : (
get_active_movement_bar maybe_navigator char =
let
max =
- (Struct.Statistics.get_movement_points
+ (Battle.Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
current =
@@ -149,7 +147,7 @@ get_inactive_movement_bar : (
get_inactive_movement_bar char =
let
max =
- (Struct.Statistics.get_movement_points
+ (Battle.Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
in
@@ -158,7 +156,7 @@ get_inactive_movement_bar char =
"MP: "
++
(String.fromInt
- (Struct.Statistics.get_movement_points
+ (Battle.Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
)
@@ -196,7 +194,7 @@ get_movement_bar char_turn char =
get_weapon_field_header : (
Float ->
- Struct.Weapon.Type ->
+ BattleCharacters.Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
get_weapon_field_header damage_multiplier weapon =
@@ -209,7 +207,7 @@ get_weapon_field_header damage_multiplier weapon =
[
]
[
- (Html.text (Struct.Weapon.get_name weapon))
+ (Html.text (BattleCharacters.Struct.Weapon.get_name weapon))
]
),
(Html.div
@@ -223,16 +221,29 @@ get_weapon_field_header damage_multiplier weapon =
(String.fromInt
(ceiling
(
- (toFloat (Struct.Weapon.get_damage_sum weapon))
+ (toFloat
+ (BattleCharacters.Struct.Weapon.get_damage_sum
+ weapon
+ )
+ )
* damage_multiplier
)
)
)
++ " dmg @ ["
++
- (String.fromInt (Struct.Weapon.get_defense_range weapon))
+ (String.fromInt
+ (BattleCharacters.Struct.Weapon.get_defense_range
+ weapon
+ )
+ )
++ ", "
- ++ (String.fromInt (Struct.Weapon.get_attack_range weapon))
+ ++
+ (String.fromInt
+ (BattleCharacters.Struct.Weapon.get_attack_range
+ weapon
+ )
+ )
++ "]"
)
)
@@ -243,9 +254,7 @@ get_weapon_field_header damage_multiplier weapon =
get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type)
get_mod_html mod =
- let
- (category, value) = mod
- in
+ let (category, value) = mod in
(Html.div
[
(Html.Attributes.class "info-card-mod")
@@ -259,9 +268,7 @@ get_mod_html mod =
get_multiplied_mod_html : Float -> (String, Int) -> (Html.Html Struct.Event.Type)
get_multiplied_mod_html multiplier mod =
- let
- (category, value) = mod
- in
+ let (category, value) = mod in
(Html.div
[
(Html.Attributes.class "character-card-mod")
@@ -282,9 +289,9 @@ get_multiplied_mod_html multiplier mod =
)
get_weapon_details : (
- Struct.Omnimods.Type ->
+ Battle.Struct.Omnimods.Type ->
Float ->
- Struct.Weapon.Type ->
+ BattleCharacters.Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
get_weapon_details omnimods damage_multiplier weapon =
@@ -300,7 +307,7 @@ get_weapon_details omnimods damage_multiplier weapon =
]
(List.map
(get_multiplied_mod_html damage_multiplier)
- (Struct.Omnimods.get_attack_mods omnimods)
+ (Battle.Struct.Omnimods.get_attack_mods omnimods)
)
)
]
@@ -308,7 +315,7 @@ get_weapon_details omnimods damage_multiplier weapon =
get_weapon_summary : (
Float ->
- Struct.Weapon.Type ->
+ BattleCharacters.Struct.Weapon.Type ->
(Html.Html Struct.Event.Type)
)
get_weapon_summary damage_multiplier weapon =
@@ -322,8 +329,8 @@ get_weapon_summary damage_multiplier weapon =
)
get_armor_details : (
- Struct.Omnimods.Type ->
- Struct.Armor.Type ->
+ Battle.Struct.Omnimods.Type ->
+ BattleCharacters.Struct.Armor.Type ->
(Html.Html Struct.Event.Type)
)
get_armor_details omnimods armor =
@@ -337,7 +344,7 @@ get_armor_details omnimods armor =
(Html.Attributes.class "character-card-armor-name")
]
[
- (Html.text (Struct.Armor.get_name armor))
+ (Html.text (BattleCharacters.Struct.Armor.get_name armor))
]
),
(Html.div
@@ -346,13 +353,13 @@ get_armor_details omnimods armor =
]
(List.map
(get_mod_html)
- (Struct.Omnimods.get_defense_mods omnimods)
+ (Battle.Struct.Omnimods.get_defense_mods omnimods)
)
)
]
)
-stat_name : String -> (Html.Html Struct.Event.Type)
+stat_name : String -> (Html.Html Struct.Event.Type)
stat_name name =
(Html.div
[
@@ -374,20 +381,14 @@ stat_val val perc =
(
(String.fromInt val)
++
- (
- if perc
- then
- "%"
- else
- ""
- )
+ (if perc then "%" else "")
)
)
]
)
get_relevant_stats : (
- Struct.Statistics.Type ->
+ Battle.Struct.Statistics.Type ->
(Html.Html Struct.Event.Type)
)
get_relevant_stats stats =
@@ -397,15 +398,15 @@ get_relevant_stats stats =
]
[
(stat_name "Dodge"),
- (stat_val (Struct.Statistics.get_dodges stats) True),
+ (stat_val (Battle.Struct.Statistics.get_dodges stats) True),
(stat_name "Parry"),
- (stat_val (Struct.Statistics.get_parries stats) True),
+ (stat_val (Battle.Struct.Statistics.get_parries stats) True),
(stat_name "Accu."),
- (stat_val (Struct.Statistics.get_accuracy stats) False),
+ (stat_val (Battle.Struct.Statistics.get_accuracy stats) False),
(stat_name "2xHit"),
- (stat_val (Struct.Statistics.get_double_hits stats) True),
+ (stat_val (Battle.Struct.Statistics.get_double_hits stats) True),
(stat_name "Crit."),
- (stat_val (Struct.Statistics.get_critical_hits stats) True)
+ (stat_val (Battle.Struct.Statistics.get_critical_hits stats) True)
]
)
@@ -457,11 +458,22 @@ get_summary_html : (
)
get_summary_html char_turn player_ix char =
let
- weapon_set = (Struct.Character.get_weapons char)
- main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set)
+ is_using_primary = (Struct.Character.get_is_using_primary char)
+ active_weapon =
+ (
+ if (is_using_primary)
+ then (Struct.Character.get_primary_weapon char)
+ else (Struct.Character.get_secondary_weapon char)
+ )
+ inactive_weapon =
+ (
+ if (is_using_primary)
+ then (Struct.Character.get_secondary_weapon char)
+ else (Struct.Character.get_primary_weapon char)
+ )
char_statistics = (Struct.Character.get_statistics char)
- damage_modifier = (Struct.Statistics.get_damage_modifier char_statistics)
- secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set)
+ damage_modifier =
+ (Battle.Struct.Statistics.get_damage_modifier char_statistics)
omnimods = (Struct.Character.get_current_omnimods char)
in
(Html.div
@@ -489,10 +501,10 @@ get_summary_html char_turn player_ix char =
(get_statuses char)
]
),
- (get_weapon_details omnimods damage_modifier main_weapon),
+ (get_weapon_details omnimods damage_modifier active_weapon),
(get_armor_details omnimods (Struct.Character.get_armor char)),
(get_relevant_stats char_statistics),
- (get_weapon_summary damage_modifier secondary_weapon)
+ (get_weapon_summary damage_modifier inactive_weapon)
]
)
@@ -503,13 +515,24 @@ get_full_html : (
)
get_full_html player_ix char =
let
- weapon_set = (Struct.Character.get_weapons char)
- main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set)
+ is_using_primary = (Struct.Character.get_is_using_primary char)
+ active_weapon =
+ (
+ if (is_using_primary)
+ then (Struct.Character.get_primary_weapon char)
+ else (Struct.Character.get_secondary_weapon char)
+ )
+ inactive_weapon =
+ (
+ if (is_using_primary)
+ then (Struct.Character.get_secondary_weapon char)
+ else (Struct.Character.get_primary_weapon char)
+ )
char_statistics = (Struct.Character.get_statistics char)
- damage_modifier = (Struct.Statistics.get_damage_modifier char_statistics)
- secondary_weapon = (Struct.WeaponSet.get_secondary_weapon weapon_set)
- armor = (Struct.Character.get_armor char)
+ damage_modifier =
+ (Battle.Struct.Statistics.get_damage_modifier char_statistics)
omnimods = (Struct.Character.get_current_omnimods char)
+ armor = (Struct.Character.get_armor char)
in
(Html.div
[
@@ -537,9 +560,9 @@ get_full_html player_ix char =
(get_statuses char)
]
),
- (get_weapon_details omnimods damage_modifier main_weapon),
+ (get_weapon_details omnimods damage_modifier active_weapon),
(get_armor_details omnimods armor),
(get_relevant_stats char_statistics),
- (get_weapon_summary damage_modifier secondary_weapon)
+ (get_weapon_summary damage_modifier inactive_weapon)
]
)
diff --git a/src/battle/src/View/Controlled/ManualControls.elm b/src/battle/src/View/Controlled/ManualControls.elm
index 7dd88e7..d65bd1a 100644
--- a/src/battle/src/View/Controlled/ManualControls.elm
+++ b/src/battle/src/View/Controlled/ManualControls.elm
@@ -5,15 +5,17 @@ import Html
import Html.Attributes
import Html.Events
--- Map -------------------------------------------------------------------
-import Struct.Direction
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
direction_button : (
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
String ->
(Html.Html Struct.Event.Type)
)
@@ -51,10 +53,10 @@ get_html =
(Html.Attributes.class "manual-controls")
]
[
- (direction_button Struct.Direction.Left "left"),
- (direction_button Struct.Direction.Down "down"),
- (direction_button Struct.Direction.Up "up"),
- (direction_button Struct.Direction.Right "right"),
+ (direction_button BattleMap.Struct.Direction.Left "left"),
+ (direction_button BattleMap.Struct.Direction.Down "down"),
+ (direction_button BattleMap.Struct.Direction.Up "up"),
+ (direction_button BattleMap.Struct.Direction.Right "right"),
(go_button)
]
)
diff --git a/src/battle/src/View/Controlled/Targets.elm b/src/battle/src/View/Controlled/Targets.elm
index c92d1d4..f057cba 100644
--- a/src/battle/src/View/Controlled/Targets.elm
+++ b/src/battle/src/View/Controlled/Targets.elm
@@ -6,11 +6,13 @@ import Dict
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Statistics
+
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
import Struct.Model
-import Struct.Statistics
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -34,7 +36,7 @@ get_target_info_html model char_ref =
++ "): "
++
(String.fromInt
- (Struct.Statistics.get_movement_points
+ (Battle.Struct.Statistics.get_movement_points
(Struct.Character.get_statistics char)
)
)
@@ -48,7 +50,7 @@ get_target_info_html model char_ref =
++ "/"
++
(String.fromInt
- (Struct.Statistics.get_max_health
+ (Battle.Struct.Statistics.get_max_health
(Struct.Character.get_statistics char)
)
)
diff --git a/src/battle/src/View/Gauge.elm b/src/battle/src/View/Gauge.elm
index d7ea8b1..50dbea3 100644
--- a/src/battle/src/View/Gauge.elm
+++ b/src/battle/src/View/Gauge.elm
@@ -4,7 +4,7 @@ module View.Gauge exposing (get_html)
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
--------------------------------------------------------------------------------
diff --git a/src/battle/src/View/MainMenu.elm b/src/battle/src/View/MainMenu.elm
index e436555..a40b2a3 100644
--- a/src/battle/src/View/MainMenu.elm
+++ b/src/battle/src/View/MainMenu.elm
@@ -5,7 +5,7 @@ import Html
import Html.Attributes
import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.UI
diff --git a/src/battle/src/View/Map.elm b/src/battle/src/View/Map.elm
index 6ae3e01..1de8472 100644
--- a/src/battle/src/View/Map.elm
+++ b/src/battle/src/View/Map.elm
@@ -9,26 +9,31 @@ import Html.Lazy
import List
--- Map -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
+-- Battle ----------------------------------------------------------------------
+import View.BattleMap.Tile
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+
+-- Local Module ----------------------------------------------------------------
import Constants.UI
-import Struct.Map
import Struct.Character
import Struct.Event
import Struct.Model
import Struct.Navigator
import Struct.UI
-import Util.Html
-
import View.Map.Character
import View.Map.Navigator
-import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_tiles_html : Struct.Map.Type -> (Html.Html Struct.Event.Type)
+get_tiles_html : BattleMap.Struct.Map.Type -> (Html.Html Struct.Event.Type)
get_tiles_html map =
(Html.div
[
@@ -38,7 +43,7 @@ get_tiles_html map =
(
(String.fromInt
(
- (Struct.Map.get_width map)
+ (BattleMap.Struct.Map.get_width map)
* Constants.UI.tile_size
)
)
@@ -50,7 +55,7 @@ get_tiles_html map =
(
(String.fromInt
(
- (Struct.Map.get_height map)
+ (BattleMap.Struct.Map.get_height map)
* Constants.UI.tile_size
)
)
@@ -59,8 +64,8 @@ get_tiles_html map =
)
]
(List.map
- (View.Map.Tile.get_html)
- (Array.toList (Struct.Map.get_tiles map))
+ (View.BattleMap.Tile.get_html False)
+ (Array.toList (BattleMap.Struct.Map.get_tiles map))
)
)
diff --git a/src/battle/src/View/Map/Character.elm b/src/battle/src/View/Map/Character.elm
index af41050..6031cff 100644
--- a/src/battle/src/View/Map/Character.elm
+++ b/src/battle/src/View/Map/Character.elm
@@ -5,16 +5,19 @@ import Html
import Html.Attributes
import Html.Events
--- Battle ----------------------------------------------------------------------
-import Constants.UI
-
+-- Shared ----------------------------------------------------------------------
import Util.Html
+-- Battle Characters -----------------------------------------------------------
+import BattleCharacters.Struct.Portrait
+
+-- Local Module ----------------------------------------------------------------
+import Constants.UI
+
import Struct.Character
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
-import Struct.Portrait
import Struct.TurnResult
import Struct.TurnResultAnimator
import Struct.UI
@@ -147,7 +150,7 @@ get_head_html char =
(Html.Attributes.class "character-icon-head"),
(Html.Attributes.class
("asset-character-icon-" ++
- (Struct.Portrait.get_icon_id
+ (BattleCharacters.Struct.Portrait.get_icon_id
(Struct.Character.get_portrait char)
)
)
diff --git a/src/battle/src/View/Map/Navigator.elm b/src/battle/src/View/Map/Navigator.elm
index 0cfce61..9727046 100644
--- a/src/battle/src/View/Map/Navigator.elm
+++ b/src/battle/src/View/Map/Navigator.elm
@@ -7,12 +7,14 @@ import Html.Events
import List
--- Map -------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Constants.UI
-import Struct.Direction
import Struct.Event
-import Struct.Location
import Struct.Marker
import Struct.Navigator
@@ -21,11 +23,11 @@ import Struct.Navigator
--------------------------------------------------------------------------------
marker_get_html : (
Bool ->
- (Struct.Location.Ref, Struct.Marker.Type) ->
+ (BattleMap.Struct.Location.Ref, Struct.Marker.Type) ->
(Html.Html Struct.Event.Type)
)
marker_get_html is_interactive (loc_ref, marker) =
- let loc = (Struct.Location.from_ref loc_ref) in
+ let loc = (BattleMap.Struct.Location.from_ref loc_ref) in
(Html.div
(
[
@@ -94,21 +96,21 @@ marker_get_html is_interactive (loc_ref, marker) =
path_node_get_html : (
Bool ->
- Struct.Direction.Type ->
+ BattleMap.Struct.Direction.Type ->
(
- Struct.Location.Type,
- Struct.Direction.Type,
+ BattleMap.Struct.Location.Type,
+ BattleMap.Struct.Direction.Type,
(List (Html.Html Struct.Event.Type))
) ->
(
- Struct.Location.Type,
- Struct.Direction.Type,
+ BattleMap.Struct.Location.Type,
+ BattleMap.Struct.Direction.Type,
(List (Html.Html Struct.Event.Type))
)
)
path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =
(
- (Struct.Location.neighbor next_dir curr_loc),
+ (BattleMap.Struct.Location.neighbor next_dir curr_loc),
next_dir,
(
(Html.div
@@ -128,14 +130,14 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =
(
"path-icon-"
++
- (Struct.Direction.to_string curr_dir)
+ (BattleMap.Struct.Direction.to_string curr_dir)
++
- (Struct.Direction.to_string next_dir)
+ (BattleMap.Struct.Direction.to_string next_dir)
)
),
(Html.Events.onClick
(Struct.Event.CharacterOrTileSelected
- (Struct.Location.get_ref curr_loc)
+ (BattleMap.Struct.Location.get_ref curr_loc)
)
),
(Html.Attributes.style
@@ -168,8 +170,8 @@ path_node_get_html is_below_markers next_dir (curr_loc, curr_dir, curr_nodes) =
)
mark_the_spot : (
- Struct.Location.Type ->
- Struct.Direction.Type ->
+ BattleMap.Struct.Location.Type ->
+ BattleMap.Struct.Direction.Type ->
(Html.Html Struct.Event.Type)
)
mark_the_spot loc origin_dir =
@@ -182,11 +184,13 @@ mark_the_spot loc origin_dir =
(
"path-icon-mark"
++
- (Struct.Direction.to_string origin_dir)
+ (BattleMap.Struct.Direction.to_string origin_dir)
)
),
(Html.Events.onClick
- (Struct.Event.CharacterOrTileSelected (Struct.Location.get_ref loc))
+ (Struct.Event.CharacterOrTileSelected
+ (BattleMap.Struct.Location.get_ref loc)
+ )
),
(Html.Attributes.style
"top"
@@ -220,7 +224,11 @@ get_html nav_summary is_interactive =
(final_loc, final_dir, path_node_htmls) =
(List.foldr
(path_node_get_html nav_summary.locked_path)
- (nav_summary.starting_location, Struct.Direction.None, [])
+ (
+ nav_summary.starting_location,
+ BattleMap.Struct.Direction.None,
+ []
+ )
nav_summary.path
)
in
diff --git a/src/battle/src/View/Map/Tile.elm b/src/battle/src/View/Map/Tile.elm
deleted file mode 100644
index abadea1..0000000
--- a/src/battle/src/View/Map/Tile.elm
+++ /dev/null
@@ -1,130 +0,0 @@
-module View.Map.Tile exposing (get_html, get_content_html)
-
--- Elm -------------------------------------------------------------------------
-import Html
-import Html.Attributes
-import Html.Events
-
--- Map -------------------------------------------------------------------
-import Constants.UI
-import Constants.IO
-
-import Struct.Event
-import Struct.Location
-import Struct.TileInstance
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_layer_html : (
- Int ->
- Struct.TileInstance.Border ->
- (Html.Html Struct.Event.Type)
- )
-get_layer_html index border =
- (Html.div
- [
- (Html.Attributes.class ("tile-icon-f-" ++ (String.fromInt index))),
- (Html.Attributes.style
- "background-image"
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.TileInstance.get_border_class_id border)
- ++ "-f-"
- ++ (Struct.TileInstance.get_border_variant_id border)
- ++ ".svg)"
- )
- )
- ]
- []
- )
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_content_html : (
- Struct.TileInstance.Type ->
- (List (Html.Html Struct.Event.Type))
- )
-get_content_html tile =
- (
- (Html.div
- [
- (Html.Attributes.class "tile-icon-bg"),
- (Html.Attributes.style
- "background-image"
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.TileInstance.get_class_id tile)
- ++ "-bg.svg)"
- )
- )
- ]
- []
- )
- ::
- (
- (Html.div
- [
- (Html.Attributes.class "tile-icon-dt"),
- (Html.Attributes.style
- "background-image"
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.TileInstance.get_class_id tile)
- ++ "-v-"
- ++ (Struct.TileInstance.get_variant_id tile)
- ++ ".svg)"
- )
- )
- ]
- []
- )
- ::
- (List.indexedMap
- (get_layer_html)
- (Struct.TileInstance.get_borders tile)
- )
- )
- )
-
-get_html : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
-get_html tile =
- let tile_loc = (Struct.TileInstance.get_location tile) in
- (Html.div
- [
- (Html.Attributes.class "tile-icon"),
- (Html.Attributes.class "tiled"),
- (Html.Attributes.class
- (
- "tile-variant-"
- ++
- (String.fromInt
- (Struct.TileInstance.get_local_variant_ix tile)
- )
- )
- ),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.TileSelected (Struct.Location.get_ref tile_loc))
- ),
- (Html.Attributes.style
- "top"
- (
- (String.fromInt (tile_loc.y * Constants.UI.tile_size))
- ++ "px"
- )
- ),
- (Html.Attributes.style
- "left"
- (
- (String.fromInt (tile_loc.x * Constants.UI.tile_size))
- ++ "px"
- )
- )
- ]
- (get_content_html tile)
- )
diff --git a/src/battle/src/View/MessageBoard.elm b/src/battle/src/View/MessageBoard.elm
index 736f938..082d2c9 100644
--- a/src/battle/src/View/MessageBoard.elm
+++ b/src/battle/src/View/MessageBoard.elm
@@ -3,7 +3,7 @@ module View.MessageBoard exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
--- Struct.Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
diff --git a/src/battle/src/View/MessageBoard/Animator.elm b/src/battle/src/View/MessageBoard/Animator.elm
index 49bb83a..c653e5e 100644
--- a/src/battle/src/View/MessageBoard/Animator.elm
+++ b/src/battle/src/View/MessageBoard/Animator.elm
@@ -3,14 +3,15 @@ module View.MessageBoard.Animator exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
--- Map -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.TurnResult
import Struct.TurnResultAnimator
-import Util.Html
-
import View.MessageBoard.Animator.Attack
--------------------------------------------------------------------------------
diff --git a/src/battle/src/View/MessageBoard/Animator/Attack.elm b/src/battle/src/View/MessageBoard/Animator/Attack.elm
index b715ac5..93a5e8a 100644
--- a/src/battle/src/View/MessageBoard/Animator/Attack.elm
+++ b/src/battle/src/View/MessageBoard/Animator/Attack.elm
@@ -6,13 +6,14 @@ import Array
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Attack
import Struct.Character
import Struct.Event
import Struct.Model
import View.Controlled.CharacterCard
+
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
diff --git a/src/battle/src/View/MessageBoard/Error.elm b/src/battle/src/View/MessageBoard/Error.elm
index c03467a..72de518 100644
--- a/src/battle/src/View/MessageBoard/Error.elm
+++ b/src/battle/src/View/MessageBoard/Error.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Error exposing (get_html)
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Error
import Struct.Event
import Struct.Model
diff --git a/src/battle/src/View/MessageBoard/Help.elm b/src/battle/src/View/MessageBoard/Help.elm
index a1d1af7..6b8480f 100644
--- a/src/battle/src/View/MessageBoard/Help.elm
+++ b/src/battle/src/View/MessageBoard/Help.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Help exposing (get_html)
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.HelpRequest
import Struct.Model
diff --git a/src/battle/src/View/MessageBoard/Help/Guide.elm b/src/battle/src/View/MessageBoard/Help/Guide.elm
index 38c2a9a..deb5190 100644
--- a/src/battle/src/View/MessageBoard/Help/Guide.elm
+++ b/src/battle/src/View/MessageBoard/Help/Guide.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Help.Guide exposing (get_html_contents)
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
diff --git a/src/battle/src/View/MessageBoard/Help/Rank.elm b/src/battle/src/View/MessageBoard/Help/Rank.elm
index 9e9a858..a4634a4 100644
--- a/src/battle/src/View/MessageBoard/Help/Rank.elm
+++ b/src/battle/src/View/MessageBoard/Help/Rank.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Help.Rank exposing (get_html_contents)
import Html
import Html.Attributes
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
diff --git a/src/battle/src/View/SubMenu.elm b/src/battle/src/View/SubMenu.elm
index a010019..60a1c7d 100644
--- a/src/battle/src/View/SubMenu.elm
+++ b/src/battle/src/View/SubMenu.elm
@@ -7,14 +7,15 @@ import Html
import Html.Attributes
import Html.Lazy
--- Map -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
+-- Local Module ----------------------------------------------------------------
import Struct.CharacterTurn
import Struct.Event
import Struct.Model
import Struct.UI
-import Util.Html
-
import View.Controlled.CharacterCard
import View.SubMenu.Characters
diff --git a/src/battle/src/View/SubMenu/Characters.elm b/src/battle/src/View/SubMenu/Characters.elm
index e433ab0..411e5e0 100644
--- a/src/battle/src/View/SubMenu/Characters.elm
+++ b/src/battle/src/View/SubMenu/Characters.elm
@@ -1,13 +1,13 @@
module View.SubMenu.Characters exposing (get_html)
-- Elm -------------------------------------------------------------------------
-import Array
+import Array
import Html
import Html.Attributes
import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
diff --git a/src/battle/src/View/SubMenu/Settings.elm b/src/battle/src/View/SubMenu/Settings.elm
index 0becac1..d214c7b 100644
--- a/src/battle/src/View/SubMenu/Settings.elm
+++ b/src/battle/src/View/SubMenu/Settings.elm
@@ -5,7 +5,7 @@ import Html
import Html.Attributes
import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
diff --git a/src/battle/src/View/SubMenu/Status.elm b/src/battle/src/View/SubMenu/Status.elm
index afb9f09..b5d69f7 100644
--- a/src/battle/src/View/SubMenu/Status.elm
+++ b/src/battle/src/View/SubMenu/Status.elm
@@ -7,9 +7,11 @@ import Html
import Html.Attributes
import Html.Lazy
--- Struct.Map -------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
-import Struct.Location
import Struct.Model
import Struct.UI
@@ -34,7 +36,7 @@ get_html model =
(Just (Struct.UI.SelectedLocation loc)) ->
(View.SubMenu.Status.TileInfo.get_html
model
- (Struct.Location.from_ref loc)
+ (BattleMap.Struct.Location.from_ref loc)
)
(Just (Struct.UI.SelectedCharacter target_char)) ->
diff --git a/src/battle/src/View/SubMenu/Status/CharacterInfo.elm b/src/battle/src/View/SubMenu/Status/CharacterInfo.elm
index 094b8d0..a8891e4 100644
--- a/src/battle/src/View/SubMenu/Status/CharacterInfo.elm
+++ b/src/battle/src/View/SubMenu/Status/CharacterInfo.elm
@@ -4,7 +4,7 @@ module View.SubMenu.Status.CharacterInfo exposing (get_html)
import Html
import Html.Attributes
--- Struct.Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
diff --git a/src/battle/src/View/SubMenu/Status/TileInfo.elm b/src/battle/src/View/SubMenu/Status/TileInfo.elm
index 44f7293..f8b2b82 100644
--- a/src/battle/src/View/SubMenu/Status/TileInfo.elm
+++ b/src/battle/src/View/SubMenu/Status/TileInfo.elm
@@ -6,25 +6,30 @@ import Dict
import Html
import Html.Attributes
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+import BattleMap.Struct.TileInstance
+
+import BattleMap.View.Map.Tile
+
+-- Local Module ----------------------------------------------------------------
import Constants.Movement
-import Struct.Map
import Struct.Event
-import Struct.Location
-import Struct.Omnimods
import Struct.Model
-import Struct.Tile
-import Struct.TileInstance
-
-import Util.Html
-
-import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_icon : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
+get_icon : (BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
get_icon tile =
(Html.div
[
@@ -35,21 +40,26 @@ get_icon tile =
"tile-variant-"
++
(String.fromInt
- (Struct.TileInstance.get_local_variant_ix tile)
+ (BattleMap.Struct.TileInstance.get_local_variant_ix tile)
)
)
)
]
- (View.Map.Tile.get_content_html tile)
+ (BattleMap.View.Map.Tile.get_content_html tile)
)
get_name : (
Struct.Model.Type ->
- Struct.TileInstance.Type ->
+ BattleMap.Struct.TileInstance.Type ->
(Html.Html Struct.Event.Type)
)
get_name model tile_inst =
- case (Dict.get (Struct.TileInstance.get_class_id tile_inst) model.tiles) of
+ case
+ (Dict.get
+ (BattleMap.Struct.TileInstance.get_class_id tile_inst)
+ model.tiles
+ )
+ of
Nothing -> (Util.Html.nothing)
(Just tile) ->
(Html.div
@@ -59,14 +69,14 @@ get_name model tile_inst =
(Html.Attributes.class "tile-card-name")
]
[
- (Html.text (Struct.Tile.get_name tile))
+ (Html.text (BattleMap.Struct.Tile.get_name tile))
]
)
-get_cost : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
+get_cost : BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
get_cost tile_inst =
let
- cost = (Struct.TileInstance.get_cost tile_inst)
+ cost = (BattleMap.Struct.TileInstance.get_cost tile_inst)
text =
if (cost > Constants.Movement.max_points)
then
@@ -84,10 +94,10 @@ get_cost tile_inst =
]
)
-get_location : Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
+get_location : BattleMap.Struct.TileInstance.Type -> (Html.Html Struct.Event.Type)
get_location tile_inst =
let
- tile_location = (Struct.TileInstance.get_location tile_inst)
+ tile_location = (BattleMap.Struct.TileInstance.get_location tile_inst)
in
(Html.div
[
@@ -132,7 +142,7 @@ get_omnimods_listing mod_list =
(List.map (get_mod_html) mod_list)
)
-get_omnimods : Struct.Omnimods.Type -> (Html.Html Struct.Event.Type)
+get_omnimods : Battle.Struct.Omnimods.Type -> (Html.Html Struct.Event.Type)
get_omnimods omnimods =
(Html.div
[
@@ -140,13 +150,21 @@ get_omnimods omnimods =
]
[
(Html.text "Attribute Modifiers"),
- (get_omnimods_listing (Struct.Omnimods.get_attributes_mods omnimods)),
+ (get_omnimods_listing
+ (Battle.Struct.Omnimods.get_attributes_mods omnimods)
+ ),
(Html.text "Statistics Modifiers"),
- (get_omnimods_listing (Struct.Omnimods.get_statistics_mods omnimods)),
+ (get_omnimods_listing
+ (Battle.Struct.Omnimods.get_statistics_mods omnimods)
+ ),
(Html.text "Attack Modifiers"),
- (get_omnimods_listing (Struct.Omnimods.get_attack_mods omnimods)),
+ (get_omnimods_listing
+ (Battle.Struct.Omnimods.get_attack_mods omnimods)
+ ),
(Html.text "Defense Modifiers"),
- (get_omnimods_listing (Struct.Omnimods.get_defense_mods omnimods))
+ (get_omnimods_listing
+ (Battle.Struct.Omnimods.get_defense_mods omnimods)
+ )
]
)
--------------------------------------------------------------------------------
@@ -154,11 +172,11 @@ get_omnimods omnimods =
--------------------------------------------------------------------------------
get_html : (
Struct.Model.Type ->
- Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
(Html.Html Struct.Event.Type)
)
get_html model loc =
- case (Struct.Map.try_getting_tile_at loc model.map) of
+ case (BattleMap.Struct.Map.try_getting_tile_at loc model.map) of
(Just tile) ->
(Html.div
[
diff --git a/src/battle/src/View/SubMenu/Timeline.elm b/src/battle/src/View/SubMenu/Timeline.elm
index a0978b5..50c1ba3 100644
--- a/src/battle/src/View/SubMenu/Timeline.elm
+++ b/src/battle/src/View/SubMenu/Timeline.elm
@@ -5,10 +5,9 @@ import Array
import Html
import Html.Attributes
---import Html.Events
import Html.Lazy
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Character
import Struct.Event
import Struct.TurnResult
diff --git a/src/battle/src/View/SubMenu/Timeline/Attack.elm b/src/battle/src/View/SubMenu/Timeline/Attack.elm
index 3eb3a04..9bd7e57 100644
--- a/src/battle/src/View/SubMenu/Timeline/Attack.elm
+++ b/src/battle/src/View/SubMenu/Timeline/Attack.elm
@@ -5,9 +5,8 @@ import Array
import Html
import Html.Attributes
---import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Attack
import Struct.Event
import Struct.TurnResult
diff --git a/src/battle/src/View/SubMenu/Timeline/Movement.elm b/src/battle/src/View/SubMenu/Timeline/Movement.elm
index 028453c..7235026 100644
--- a/src/battle/src/View/SubMenu/Timeline/Movement.elm
+++ b/src/battle/src/View/SubMenu/Timeline/Movement.elm
@@ -5,9 +5,8 @@ import Array
import Html
import Html.Attributes
---import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
import Struct.Character
diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm b/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm
index b2afd6e..7fac611 100644
--- a/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm
+++ b/src/battle/src/View/SubMenu/Timeline/PlayerDefeat.elm
@@ -3,9 +3,8 @@ module View.SubMenu.Timeline.PlayerDefeat exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
---import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm b/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm
index 1c4b829..6de8d1f 100644
--- a/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm
+++ b/src/battle/src/View/SubMenu/Timeline/PlayerTurnStart.elm
@@ -3,9 +3,8 @@ module View.SubMenu.Timeline.PlayerTurnStart exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
---import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
diff --git a/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm b/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm
index 9f166e4..396d601 100644
--- a/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm
+++ b/src/battle/src/View/SubMenu/Timeline/PlayerVictory.elm
@@ -3,9 +3,8 @@ module View.SubMenu.Timeline.PlayerVictory exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
---import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
diff --git a/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm
index 2e874b0..025c2b9 100644
--- a/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm
+++ b/src/battle/src/View/SubMenu/Timeline/WeaponSwitch.elm
@@ -5,9 +5,8 @@ import Array
import Html
import Html.Attributes
---import Html.Events
--- Map -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.TurnResult
import Struct.Character
diff --git a/src/map-editor/elm.json b/src/map-editor/elm.json
index cd41660..55f961b 100644
--- a/src/map-editor/elm.json
+++ b/src/map-editor/elm.json
@@ -2,7 +2,9 @@
"type": "application",
"source-directories": [
"src",
- "../shared/elm"
+ "../shared/elm",
+ "../shared/battle",
+ "../shared/battle-map"
],
"elm-version": "0.19.0",
"dependencies": {
@@ -26,4 +28,4 @@
"direct": {},
"indirect": {}
}
-} \ No newline at end of file
+}
diff --git a/src/map-editor/src/Struct/TileInstance.elm b/src/map-editor/src/Struct/TileInstance.elm
index 862598b..635dbac 100644
--- a/src/map-editor/src/Struct/TileInstance.elm
+++ b/src/map-editor/src/Struct/TileInstance.elm
@@ -30,12 +30,14 @@ import Json.Encode
import Json.Decode
import Json.Decode.Pipeline
+-- Battle Map ------------------------------------------------------------------
+import Struct.Tile
+import Struct.Location
+
-- Map Editor ------------------------------------------------------------------
import Constants.UI
import Constants.Movement
-import Struct.Tile
-import Struct.Location
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
diff --git a/src/map-editor/src/View/Map/Tile.elm b/src/map-editor/src/View/Map/Tile.elm
index 96fdee6..8fe96cf 100644
--- a/src/map-editor/src/View/Map/Tile.elm
+++ b/src/map-editor/src/View/Map/Tile.elm
@@ -1,112 +1,44 @@
-module View.Map.Tile exposing (get_html, get_content_html)
+module View.Map.SelectableTile exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
import Html.Attributes
import Html.Events
+-- Battle Map ------------------------------------------------------------------
+import Struct.TileInstance
+import Struct.Location
+
+import View.Map.Tile
+
-- Map Editor ------------------------------------------------------------------
import Constants.UI
import Constants.IO
import Struct.Event
-import Struct.Location
-import Struct.TileInstance
import Struct.Toolbox
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_layer_html : (
- Int ->
- Struct.TileInstance.Border ->
- (Html.Html Struct.Event.Type)
- )
-get_layer_html index border =
- (Html.div
- [
- (Html.Attributes.class
- ("tile-icon-f-" ++ (String.fromInt index))
- ),
- (Html.Attributes.style
- "background-image"
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.TileInstance.get_border_class_id border)
- ++ "-f-"
- ++ (Struct.TileInstance.get_border_variant_id border)
- ++ ".svg)"
- )
- )
- ]
- []
- )
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_content_html : (
- Struct.TileInstance.Type ->
- (List (Html.Html Struct.Event.Type))
- )
-get_content_html tile =
- (
- (Html.div
- [
- (Html.Attributes.class "tile-icon-bg"),
- (Html.Attributes.style
- "background-image"
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.TileInstance.get_class_id tile)
- ++ "-bg.svg)"
- )
- )
- ]
- []
- )
- ::
- (
- (Html.div
- [
- (Html.Attributes.class "tile-icon-dt"),
- (Html.Attributes.style
- "background-image"
- (
- "url("
- ++ Constants.IO.tile_assets_url
- ++ (Struct.TileInstance.get_class_id tile)
- ++ "-v-"
- ++ (Struct.TileInstance.get_variant_id tile)
- ++ ".svg)"
- )
- )
- ]
- []
- )
- ::
- (List.indexedMap
- (get_layer_html)
- (Struct.TileInstance.get_borders tile)
- )
- )
- )
get_html : (
+ Bool ->
Struct.Toolbox.Type ->
Struct.TileInstance.Type ->
(Html.Html Struct.Event.Type)
)
-get_html tb tile =
+get_html display_cost tb tile =
let
tile_loc = (Struct.TileInstance.get_location tile)
in
- (Html.div
+ (View.Map.Tile.get_html_with_extra
+ display_cost
[
- (Html.Attributes.class "tile-icon"),
- (Html.Attributes.class "tiled"),
(
if (Struct.Toolbox.is_selected tile_loc tb)
then (Html.Attributes.class "tile-selected")
@@ -116,34 +48,7 @@ get_html tb tile =
if (Struct.Toolbox.is_square_corner tile_loc tb)
then (Html.Attributes.class "tile-square-corner")
else (Html.Attributes.class "")
- ),
- (Html.Attributes.class
- (
- "tile-variant-"
- ++
- (String.fromInt
- (Struct.TileInstance.get_local_variant_ix tile)
- )
- )
- ),
- (Html.Attributes.class "clickable"),
- (Html.Events.onClick
- (Struct.Event.TileSelected (Struct.Location.get_ref tile_loc))
- ),
- (Html.Attributes.style
- "top"
- (
- (String.fromInt (tile_loc.y * Constants.UI.tile_size))
- ++ "px"
- )
- ),
- (Html.Attributes.style
- "left"
- (
- (String.fromInt (tile_loc.x * Constants.UI.tile_size))
- ++ "px"
- )
)
]
- (get_content_html tile)
+ tile
)
diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm
index 70e66cf..6e62ac5 100644
--- a/src/map-editor/src/View/SubMenu.elm
+++ b/src/map-editor/src/View/SubMenu.elm
@@ -4,16 +4,17 @@ module View.SubMenu exposing (get_html)
import Html
import Html.Attributes
--- Battlemap -------------------------------------------------------------------
+-- Map Editor ------------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.UI
import Util.Html
-import View.SubMenu.Tiles
+import View.SubMenu.Markers
import View.SubMenu.Settings
import View.SubMenu.TileStatus
+import View.SubMenu.Tiles
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -28,6 +29,9 @@ get_inner_html model tab =
Struct.UI.StatusTab ->
(View.SubMenu.TileStatus.get_html model)
+ Struct.UI.MarkersTab ->
+ (View.SubMenu.Markers.get_html model)
+
Struct.UI.TilesTab ->
(View.SubMenu.Tiles.get_html model)
diff --git a/src/roster-editor/elm.json b/src/roster-editor/elm.json
index 929038d..75ba72e 100644
--- a/src/roster-editor/elm.json
+++ b/src/roster-editor/elm.json
@@ -2,7 +2,9 @@
"type": "application",
"source-directories": [
"src",
- "../shared/elm"
+ "../shared/elm",
+ "../shared/battle",
+ "../shared/battle-characters"
],
"elm-version": "0.19.0",
"dependencies": {
diff --git a/src/roster-editor/src/Struct/Omnimods.elm b/src/roster-editor/src/Struct/Omnimods.elm
deleted file mode 100644
index 31f5939..0000000
--- a/src/roster-editor/src/Struct/Omnimods.elm
+++ /dev/null
@@ -1,214 +0,0 @@
-module Struct.Omnimods exposing
- (
- Type,
- new,
- merge,
- none,
- apply_to_attributes,
- apply_to_statistics,
- get_attack_damage,
- get_damage_sum,
- get_attributes_mods,
- get_statistics_mods,
- get_attack_mods,
- get_defense_mods,
- get_all_mods,
- scale,
- decoder
- )
-
--- Elm -------------------------------------------------------------------------
-import Dict
-
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Map -------------------------------------------------------------------
-import Struct.Attributes
-import Struct.Statistics
-import Struct.DamageType
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- attributes : (Dict.Dict String Int),
- statistics : (Dict.Dict String Int),
- attack : (Dict.Dict String Int),
- defense : (Dict.Dict String Int)
- }
-
-type alias GenericMod =
- {
- t : String,
- v : Int
- }
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-generic_mods_decoder : (Json.Decode.Decoder (Dict.Dict String Int))
-generic_mods_decoder =
- (Json.Decode.map
- ((Dict.fromList) >> (Dict.remove "none"))
- (Json.Decode.list
- (Json.Decode.map
- (\gm -> (gm.t, gm.v))
- (Json.Decode.succeed
- GenericMod
- |> (Json.Decode.Pipeline.required "t" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "v" Json.Decode.int)
- )
- )
- )
- )
-
-merge_mods : (
- (Dict.Dict String Int) ->
- (Dict.Dict String Int) ->
- (Dict.Dict String Int)
- )
-merge_mods a_mods b_mods =
- (Dict.merge
- (Dict.insert)
- (\t -> \v_a -> \v_b -> \r -> (Dict.insert t (v_a + v_b) r))
- (Dict.insert)
- a_mods
- b_mods
- (Dict.empty)
- )
-
-scale_dict_value : Float -> String -> Int -> Int
-scale_dict_value modifier entry_name value =
- (ceiling ((toFloat value) * modifier))
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.succeed
- Type
- |> (Json.Decode.Pipeline.required "attm" generic_mods_decoder)
- |> (Json.Decode.Pipeline.required "stam" generic_mods_decoder)
- |> (Json.Decode.Pipeline.required "atkm" generic_mods_decoder)
- |> (Json.Decode.Pipeline.required "defm" generic_mods_decoder)
- )
-
-new : (
- (List (String, Int)) ->
- (List (String, Int)) ->
- (List (String, Int)) ->
- (List (String, Int)) ->
- Type
- )
-new attribute_mods statistic_mods attack_mods defense_mods =
- {
- attributes = (Dict.fromList attribute_mods),
- statistics = (Dict.fromList statistic_mods),
- attack = (Dict.fromList attack_mods),
- defense = (Dict.fromList defense_mods)
- }
-
-none : Type
-none =
- {
- attributes = (Dict.empty),
- statistics = (Dict.empty),
- attack = (Dict.empty),
- defense = (Dict.empty)
- }
-
-merge : Type -> Type -> Type
-merge omni_a omni_b =
- {
- attributes = (merge_mods omni_a.attributes omni_b.attributes),
- statistics = (merge_mods omni_a.statistics omni_b.statistics),
- attack = (merge_mods omni_a.attack omni_b.attack),
- defense = (merge_mods omni_a.defense omni_b.defense)
- }
-
-apply_to_attributes : Type -> Struct.Attributes.Type -> Struct.Attributes.Type
-apply_to_attributes omnimods attributes =
- (Dict.foldl
- ((Struct.Attributes.decode_category) >> (Struct.Attributes.mod))
- attributes
- omnimods.attributes
- )
-
-apply_to_statistics : Type -> Struct.Statistics.Type -> Struct.Statistics.Type
-apply_to_statistics omnimods statistics =
- (Dict.foldl
- ((Struct.Statistics.decode_category) >> (Struct.Statistics.mod))
- statistics
- omnimods.statistics
- )
-
-get_damage_sum : Type -> Int
-get_damage_sum omni =
- (Dict.foldl (\t -> \v -> \result -> (result + v)) 0 omni.attack)
-
-get_attack_damage : Float -> Type -> Type -> Int
-get_attack_damage dmg_modifier atk_omni def_omni =
- let
- base_def =
- (
- case
- (Dict.get
- (Struct.DamageType.encode Struct.DamageType.Base)
- def_omni.defense
- )
- of
- (Just v) -> v
- Nothing -> 0
- )
- in
- (Dict.foldl
- (\t -> \v -> \result ->
- let
- actual_atk =
- (max
- 0
- (
- (ceiling ((toFloat v) * dmg_modifier))
- - base_def
- )
- )
- in
- case (Dict.get t def_omni.defense) of
- (Just def_v) -> (result + (max 0 (actual_atk - def_v)))
- Nothing -> (result + actual_atk)
- )
- 0
- atk_omni.attack
- )
-
-scale : Float -> Type -> Type
-scale multiplier omnimods =
- {omnimods |
- attributes = (Dict.map (scale_dict_value multiplier) omnimods.attributes),
- statistics = (Dict.map (scale_dict_value multiplier) omnimods.statistics),
- attack = (Dict.map (scale_dict_value multiplier) omnimods.attack),
- defense =
- (Dict.map (scale_dict_value multiplier) omnimods.defense)
- }
-
-get_attributes_mods : Type -> (List (String, Int))
-get_attributes_mods omnimods = (Dict.toList omnimods.attributes)
-
-get_statistics_mods : Type -> (List (String, Int))
-get_statistics_mods omnimods = (Dict.toList omnimods.statistics)
-
-get_attack_mods : Type -> (List (String, Int))
-get_attack_mods omnimods = (Dict.toList omnimods.attack)
-
-get_defense_mods : Type -> (List (String, Int))
-get_defense_mods omnimods = (Dict.toList omnimods.defense)
-
-get_all_mods : Type -> (List (String, Int))
-get_all_mods omnimods =
- (
- (get_attributes_mods omnimods)
- ++ (get_statistics_mods omnimods)
- ++ (get_attack_mods omnimods)
- ++ (get_defense_mods omnimods)
- )
diff --git a/src/roster-editor/src/Struct/Statistics.elm b/src/roster-editor/src/Struct/Statistics.elm
deleted file mode 100644
index f676648..0000000
--- a/src/roster-editor/src/Struct/Statistics.elm
+++ /dev/null
@@ -1,210 +0,0 @@
-module Struct.Statistics exposing
- (
- Type,
- Category(..),
- get_movement_points,
- get_max_health,
- get_dodges,
- get_parries,
- get_accuracy,
- get_double_hits,
- get_critical_hits,
- get_damage_modifier,
- decode_category,
- mod,
- new_raw
- )
-
--- Elm -------------------------------------------------------------------------
-import List
-
--- Battle ----------------------------------------------------------------------
-import Struct.Attributes
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type Category =
- MovementPoints
- | MaxHealth
- | Dodges
- | Parries
- | Accuracy
- | DoubleHits
- | CriticalHits
-
-type alias Type =
- {
- movement_points : Int,
- max_health : Int,
- dodges : Int,
- parries : Int,
- accuracy : Int,
- double_hits : Int,
- critical_hits : Int,
- damage_modifier : Float
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-average : (List Int) -> Float
-average l = ((toFloat (List.sum l)) / (toFloat (List.length l)))
-
-float_to_int : Float -> Int
-float_to_int f =
- (ceiling f)
-
-gentle_squared_growth : Int -> Int
-gentle_squared_growth v = (float_to_int (((toFloat v)^1.8)/20.0))
-
-gentle_squared_growth_f : Float -> Int
-gentle_squared_growth_f v = (float_to_int ((v^1.8)/20.0))
-
-sudden_squared_growth : Int -> Int
-sudden_squared_growth v = (float_to_int (((toFloat v)^2.5)/1000.0))
-
-sudden_squared_growth_f : Float -> Int
-sudden_squared_growth_f v = (float_to_int ((v^2.5)/1000.0))
-
-sudden_exp_growth : Int -> Int
-sudden_exp_growth v = (float_to_int (4.0^((toFloat v)/25.0)))
-
-sudden_exp_growth_f : Float -> Int
-sudden_exp_growth_f f = (float_to_int (4.0^(f/25.0)))
-
-damage_base_mod : Float -> Float
-damage_base_mod str = ((((str + 10) * 4)^1.5)/3000.0)
-
-make_movement_points_safe : Int -> Int
-make_movement_points_safe val = (clamp 0 200 val)
-
-make_max_health_safe : Int -> Int
-make_max_health_safe val = (max 1 val)
-
-make_dodges_safe : Int -> Int
-make_dodges_safe val = (clamp 0 100 val)
-
-make_parries_safe : Int -> Int
-make_parries_safe val = (clamp 0 75 val)
-
-make_accuracy_safe : Int -> Int
-make_accuracy_safe val = (clamp 0 100 val)
-
-make_double_hits_safe : Int -> Int
-make_double_hits_safe val = (clamp 0 100 val)
-
-make_critical_hits_safe : Int -> Int
-make_critical_hits_safe val = (clamp 0 100 val)
-
-mod_movement_points : Int -> Type -> Type
-mod_movement_points v t =
- {t |
- movement_points = (make_movement_points_safe (t.movement_points + v))
- }
-
-mod_max_health : Int -> Type -> Type
-mod_max_health v t =
- {t |
- max_health = (make_max_health_safe (t.max_health + v))
- }
-
-mod_dodges : Int -> Type -> Type
-mod_dodges v t = {t | dodges = (make_dodges_safe (t.dodges + v))}
-
-mod_parries : Int -> Type -> Type
-mod_parries v t = {t | parries = (make_parries_safe (t.parries + v))}
-
-mod_accuracy : Int -> Type -> Type
-mod_accuracy v t = {t | accuracy = (make_accuracy_safe (t.accuracy + v))}
-
-mod_double_hits : Int -> Type -> Type
-mod_double_hits v t =
- {t |
- double_hits = (make_double_hits_safe (t.double_hits + v))
- }
-
-mod_critical_hits : Int -> Type -> Type
-mod_critical_hits v t =
- {t |
- critical_hits = (make_critical_hits_safe (t.critical_hits + v))
- }
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_movement_points : Type -> Int
-get_movement_points t = t.movement_points
-
-get_max_health : Type -> Int
-get_max_health t = t.max_health
-
-get_dodges : Type -> Int
-get_dodges t = t.dodges
-
-get_parries : Type -> Int
-get_parries t = t.parries
-
-get_accuracy : Type -> Int
-get_accuracy t = t.accuracy
-
-get_double_hits : Type -> Int
-get_double_hits t = t.double_hits
-
-get_critical_hits : Type -> Int
-get_critical_hits t = t.critical_hits
-
-get_damage_modifier : Type -> Float
-get_damage_modifier t = t.damage_modifier
-
-mod : Category -> Int -> Type -> Type
-mod cat v t =
- case cat of
- MaxHealth -> (mod_max_health v t)
- MovementPoints -> (mod_movement_points v t)
- Dodges -> (mod_dodges v t)
- Parries -> (mod_parries v t)
- Accuracy -> (mod_accuracy v t)
- DoubleHits -> (mod_double_hits v t)
- CriticalHits -> (mod_critical_hits v t)
-
-new_raw : (Struct.Attributes.Type -> Type)
-new_raw att =
- let
- constitution = (Struct.Attributes.get_constitution att)
- dexterity = (Struct.Attributes.get_dexterity att)
- intelligence = (Struct.Attributes.get_intelligence att)
- mind = (Struct.Attributes.get_mind att)
- speed = (Struct.Attributes.get_speed att)
- strength = (Struct.Attributes.get_strength att)
- in
- {
- movement_points =
- (gentle_squared_growth_f
- (average [mind, constitution, constitution, speed, speed, speed])
- ),
- max_health =
- (gentle_squared_growth_f
- (average [constitution, constitution, constitution, mind])
- ),
- dodges = (sudden_exp_growth_f (average [dexterity, mind, speed])),
- parries =
- (sudden_exp_growth_f
- (average [dexterity, intelligence, speed, strength])
- ),
- accuracy = (sudden_squared_growth dexterity),
- double_hits = (sudden_squared_growth_f (average [mind, speed])),
- critical_hits = (sudden_squared_growth intelligence),
- damage_modifier = (damage_base_mod (toFloat strength))
- }
-
-decode_category : String -> Category
-decode_category str =
- case str of
- "mheal" -> MaxHealth
- "mpts" -> MovementPoints
- "dodg" -> Dodges
- "pary" -> Parries
- "accu" -> Accuracy
- "dhit" -> DoubleHits
- _ -> CriticalHits
diff --git a/src/roster-editor/src/Struct/UI.elm b/src/roster-editor/src/Struct/UI.elm
index 1c2041e..4bda5b5 100644
--- a/src/roster-editor/src/Struct/UI.elm
+++ b/src/roster-editor/src/Struct/UI.elm
@@ -9,7 +9,10 @@ module Struct.UI exposing
reset_displayed_tab,
-- Which glyph slot is being edited?
set_glyph_slot,
- get_glyph_slot
+ get_glyph_slot,
+ -- Display Tile Costs
+ get_display_tile_cost,
+ toggle_display_tile_cost
)
-- Elm -------------------------------------------------------------------------
@@ -32,7 +35,8 @@ type Tab =
type alias Type =
{
displayed_tab : Tab,
- glyph_slot : Int
+ glyph_slot : Int,
+ display_tile_cost : Bool
}
--------------------------------------------------------------------------------
@@ -64,3 +68,11 @@ get_glyph_slot ui = ui.glyph_slot
set_glyph_slot : Int -> Type -> Type
set_glyph_slot tab ui = {ui | glyph_slot = tab}
+
+-- Tile Cost -------------------------------------------------------------------
+toggle_display_tile_cost : Type -> Type
+toggle_display_tile_cost ui =
+ {ui | display_tile_cost = (not ui.display_tile_cost)}
+
+get_display_tile_cost : Type -> Bool
+get_display_tile_cost ui = ui.display_tile_cost
diff --git a/src/roster-editor/src/Struct/DamageType.elm b/src/shared/battle-characters/BattleCharacters/Comm/AddPortrait.elm
index b7bced7..a9c848b 100644
--- a/src/roster-editor/src/Struct/DamageType.elm
+++ b/src/shared/battle-characters/BattleCharacters/Comm/AddPortrait.elm
@@ -1,55 +1,24 @@
-module Struct.DamageType exposing
- (
- Type(..),
- encode,
- decode,
- to_string
- )
+module Comm.AddPortrait exposing (decode)
-- Elm -------------------------------------------------------------------------
+import Json.Decode
--- Map -------------------------------------------------------------------
+-- BattleCharacters ------------------------------------------------------------
+import Struct.Portrait
+import Struct.ServerReply
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-type Type =
- Base
- | Slash
- | Blunt
- | Pierce
- | None
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
+internal_decoder : Struct.Portrait.Type -> Struct.ServerReply.Type
+internal_decoder pt = (Struct.ServerReply.AddPortrait pt)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-decode : String -> Type
-decode str =
- case str of
- "bse" -> Base
- "slh" -> Slash
- "pie" -> Pierce
- "blu" -> Blunt
- _ -> None
-
-encode : Type -> String
-encode t =
- case t of
- Base -> "bse"
- Slash -> "slh"
- Pierce -> "pie"
- Blunt -> "blu"
- None -> "non"
-
-to_string : Type -> String
-to_string t =
- case t of
- Base -> "Base"
- Slash -> "Slash"
- Pierce -> "Piercing"
- Blunt -> "Bludgeoning"
- None -> "ERROR"
+decode : (Json.Decode.Decoder Struct.ServerReply.Type)
+decode = (Json.Decode.map (internal_decoder) (Struct.Portrait.decoder))
diff --git a/src/roster-editor/src/Struct/Armor.elm b/src/shared/battle-characters/BattleCharacters/Struct/Armor.elm
index 06689f8..5cb99d6 100644
--- a/src/roster-editor/src/Struct/Armor.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Armor.elm
@@ -1,4 +1,4 @@
-module Struct.Armor exposing
+module BattleCharacters.Struct.Armor exposing
(
Type,
Ref,
@@ -17,7 +17,7 @@ import Json.Decode
import Json.Decode.Pipeline
-- Battle ----------------------------------------------------------------------
-import Struct.Omnimods
+import Battle.Struct.Omnimods
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -26,7 +26,7 @@ type alias Type =
{
id : String,
name : String,
- omnimods : Struct.Omnimods.Type
+ omnimods : Battle.Struct.Omnimods.Type
}
type alias Ref = String
@@ -38,7 +38,7 @@ type alias Ref = String
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-new : String -> String -> Struct.Omnimods.Type -> Type
+new : String -> String -> Battle.Struct.Omnimods.Type -> Type
new id name omnimods =
{
id = id,
@@ -55,7 +55,7 @@ get_name ar = ar.name
get_image_id : Type -> String
get_image_id ar = ar.id
-get_omnimods : Type -> Struct.Omnimods.Type
+get_omnimods : Type -> Battle.Struct.Omnimods.Type
get_omnimods ar = ar.omnimods
decoder : (Json.Decode.Decoder Type)
@@ -64,11 +64,11 @@ decoder =
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
+ |> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder)
)
none : Type
-none = (new "0" "None" (Struct.Omnimods.none))
+none = (new "0" "None" (Battle.Struct.Omnimods.none))
default : Type
default = (none)
diff --git a/src/roster-editor/src/Struct/Portrait.elm b/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm
index bcdf8ae..35f5260 100644
--- a/src/roster-editor/src/Struct/Portrait.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm
@@ -1,4 +1,4 @@
-module Struct.Portrait exposing
+module BattleCharacters.Struct.Portrait exposing
(
Type,
Ref,
@@ -14,8 +14,6 @@ module Struct.Portrait exposing
import Json.Decode
import Json.Decode.Pipeline
--- Roster Editor ---------------------------------------------------------------
-
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
diff --git a/src/roster-editor/src/Struct/Weapon.elm b/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm
index 0ab0ec7..0aff932 100644
--- a/src/roster-editor/src/Struct/Weapon.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Weapon.elm
@@ -1,4 +1,4 @@
-module Struct.Weapon exposing
+module BattleCharacters.Struct.Weapon exposing
(
Type,
Ref,
@@ -18,8 +18,8 @@ module Struct.Weapon exposing
import Json.Decode
import Json.Decode.Pipeline
--- Map -------------------------------------------------------------------
-import Struct.Omnimods
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -31,7 +31,7 @@ type alias Type =
is_primary : Bool,
def_range : Int,
atk_range : Int,
- omnimods : Struct.Omnimods.Type,
+ omnimods : Battle.Struct.Omnimods.Type,
damage_sum : Int
}
@@ -59,7 +59,7 @@ get_attack_range wp = wp.atk_range
get_defense_range : Type -> Int
get_defense_range wp = wp.def_range
-get_omnimods : Type -> Struct.Omnimods.Type
+get_omnimods : Type -> Battle.Struct.Omnimods.Type
get_omnimods wp = wp.omnimods
get_damage_sum : Type -> Int
@@ -68,7 +68,9 @@ get_damage_sum wp = wp.damage_sum
decoder : (Json.Decode.Decoder Type)
decoder =
(Json.Decode.map
- (\e -> {e | damage_sum = (Struct.Omnimods.get_damage_sum e.omnimods)})
+ (\e ->
+ {e | damage_sum = (Battle.Struct.Omnimods.get_damage_sum e.omnimods)}
+ )
(Json.Decode.succeed
Type
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
@@ -76,7 +78,7 @@ decoder =
|> (Json.Decode.Pipeline.required "pri" Json.Decode.bool)
|> (Json.Decode.Pipeline.required "rmi" Json.Decode.int)
|> (Json.Decode.Pipeline.required "rma" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
+ |> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder)
|> (Json.Decode.Pipeline.hardcoded 0)
)
)
@@ -89,7 +91,7 @@ none =
is_primary = False,
def_range = 0,
atk_range = 0,
- omnimods = (Struct.Omnimods.none),
+ omnimods = (Battle.Struct.Omnimods.none),
damage_sum = 0
}
diff --git a/src/battle/src/Struct/Direction.elm b/src/shared/battle-map/BattleMap/Struct/Direction.elm
index 6fd0a66..4620e29 100644
--- a/src/battle/src/Struct/Direction.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Direction.elm
@@ -1,9 +1,15 @@
-module Struct.Direction exposing (Type(..), opposite_of, to_string, decoder)
+module BattleMap.Struct.Direction exposing
+(
+ Type(..),
+ opposite_of,
+ to_string,
+ decoder
+)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Map -------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
diff --git a/src/battle/src/Struct/Location.elm b/src/shared/battle-map/BattleMap/Struct/Location.elm
index 90f1e03..3443150 100644
--- a/src/battle/src/Struct/Location.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Location.elm
@@ -1,4 +1,4 @@
-module Struct.Location exposing (..)
+module BattleMap.Struct.Location exposing (..)
-- Elm -------------------------------------------------------------------------
import Json.Decode
@@ -6,8 +6,8 @@ import Json.Decode.Pipeline
import Json.Encode
--- Battle ----------------------------------------------------------------------
-import Struct.Direction
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Direction
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -27,14 +27,14 @@ type alias Ref = (Int, Int)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-neighbor : Struct.Direction.Type -> Type -> Type
+neighbor : BattleMap.Struct.Direction.Type -> Type -> Type
neighbor dir loc =
case dir of
- Struct.Direction.Right -> {loc | x = (loc.x + 1)}
- Struct.Direction.Left -> {loc | x = (loc.x - 1)}
- Struct.Direction.Up -> {loc | y = (loc.y - 1)}
- Struct.Direction.Down -> {loc | y = (loc.y + 1)}
- Struct.Direction.None -> loc
+ BattleMap.Struct.Direction.Right -> {loc | x = (loc.x + 1)}
+ BattleMap.Struct.Direction.Left -> {loc | x = (loc.x - 1)}
+ BattleMap.Struct.Direction.Up -> {loc | y = (loc.y - 1)}
+ BattleMap.Struct.Direction.Down -> {loc | y = (loc.y + 1)}
+ BattleMap.Struct.Direction.None -> loc
get_ref : Type -> Ref
get_ref l =
diff --git a/src/shared/battle-map/BattleMap/Struct/Map.elm b/src/shared/battle-map/BattleMap/Struct/Map.elm
new file mode 100644
index 0000000..aa166d4
--- /dev/null
+++ b/src/shared/battle-map/BattleMap/Struct/Map.elm
@@ -0,0 +1,206 @@
+module BattleMap.Struct.Map exposing
+ (
+ Type,
+ decoder,
+ empty,
+ get_height,
+ get_markers,
+ get_movement_cost_function,
+ get_omnimods_at,
+ get_tiles,
+ get_width,
+ new,
+ set_tile_to,
+ solve_tiles,
+ try_getting_tile_at
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Array
+
+import Dict
+
+import Json.Decode
+
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.MapMarker
+import BattleMap.Struct.Tile
+import BattleMap.Struct.TileInstance
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias Type =
+ {
+ width : Int,
+ height : Int,
+ content : (Array.Array BattleMap.Struct.TileInstance.Type),
+ markers : (Dict.Dict String BattleMap.Struct.MapMarker.Type)
+ }
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+location_to_index : BattleMap.Struct.Location.Type -> Type -> Int
+location_to_index loc map =
+ ((loc.y * map.width) + loc.x)
+
+has_location : BattleMap.Struct.Location.Type -> Type -> Bool
+has_location loc map =
+ (
+ (loc.x >= 0)
+ && (loc.y >= 0)
+ && (loc.x < map.width)
+ && (loc.y < map.height)
+ )
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_width : Type -> Int
+get_width map = map.width
+
+get_height : Type -> Int
+get_height map = map.height
+
+get_tiles : Type -> (Array.Array BattleMap.Struct.TileInstance.Type)
+get_tiles map = map.content
+
+get_markers : Type -> (Dict.Dict String BattleMap.Struct.MapMarker.Type)
+get_markers map = map.markers
+
+set_tile_to : BattleMap.Struct.Location.Type -> BattleMap.Struct.TileInstance.Type -> Type -> Type
+set_tile_to loc tile_inst map =
+ {map |
+ content = (Array.set (location_to_index loc map) tile_inst map.content)
+ }
+
+empty : Type
+empty =
+ {
+ width = 0,
+ height = 0,
+ content = (Array.empty),
+ markers = (Dict.empty)
+ }
+
+new : Int -> Int -> (List BattleMap.Struct.TileInstance.Type) -> Type
+new width height tiles =
+ {
+ width = width,
+ height = height,
+ content = (Array.fromList tiles),
+ markers = (Dict.empty)
+ }
+
+try_getting_tile_at : (
+ BattleMap.Struct.Location.Type ->
+ Type ->
+ (Maybe BattleMap.Struct.TileInstance.Type)
+ )
+try_getting_tile_at loc map =
+ if (has_location loc map)
+ then (Array.get (location_to_index loc map) map.content)
+ else Nothing
+
+solve_tiles : (
+ (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type) ->
+ Type ->
+ Type
+ )
+solve_tiles tiles map =
+ {map |
+ content =
+ (Array.map
+ (BattleMap.Struct.TileInstance.solve tiles) map.content
+ )
+ }
+
+get_omnimods_at : (
+ BattleMap.Struct.Location.Type ->
+ (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type) ->
+ Type ->
+ Battle.Struct.Omnimods.Type
+ )
+get_omnimods_at loc tiles_solver map =
+ case (try_getting_tile_at loc map) of
+ Nothing -> (Battle.Struct.Omnimods.none)
+ (Just tile_inst) ->
+ case
+ (Dict.get
+ (BattleMap.Struct.TileInstance.get_class_id tile_inst)
+ tiles_solver
+ )
+ of
+ Nothing -> (Battle.Struct.Omnimods.none)
+ (Just tile) -> (BattleMap.Struct.Tile.get_omnimods tile)
+
+decoder : (Json.Decode.Decoder Type)
+decoder =
+ (Json.Decode.andThen
+ (\width ->
+ (Json.Decode.map4
+ Type
+ (Json.Decode.field "w" Json.Decode.int)
+ (Json.Decode.field "h" Json.Decode.int)
+ (Json.Decode.field
+ "t"
+ (Json.Decode.map
+ (Array.indexedMap
+ (BattleMap.Struct.TileInstance.set_location_from_index
+ width
+ )
+ )
+ (Json.Decode.array (BattleMap.Struct.TileInstance.decoder))
+ )
+ )
+ (Json.Decode.field
+ "m"
+ (Json.Decode.map
+ (Dict.fromList)
+ (Json.Decode.keyValuePairs
+ (BattleMap.Struct.MapMarker.decoder)
+ )
+ )
+ )
+ )
+ )
+ (Json.Decode.field "w" Json.Decode.int)
+ )
+
+get_movement_cost_function : (
+ Type ->
+ BattleMap.Struct.Location.Type ->
+ (List BattleMap.Struct.Character.Type) ->
+ BattleMap.Struct.Location.Type ->
+ Int
+ )
+get_movement_cost_function bmap start_loc char_list loc =
+ if (has_location loc bmap)
+ then
+ case (Array.get (location_to_index loc bmap) bmap.content) of
+ (Just tile) ->
+ if
+ (List.any
+ (
+ \c ->
+ (
+ ((BattleMap.Struct.Character.get_location c) == loc)
+ && (loc /= start_loc)
+ && (BattleMap.Struct.Character.is_alive c)
+ )
+ )
+ char_list
+ )
+ then
+ Constants.Movement.cost_when_occupied_tile
+ else
+ (BattleMap.Struct.TileInstance.get_cost tile)
+
+ Nothing -> Constants.Movement.cost_when_out_of_bounds
+ else
+ Constants.Movement.cost_when_out_of_bounds
diff --git a/src/battle/src/Struct/Tile.elm b/src/shared/battle-map/BattleMap/Struct/Tile.elm
index 459e139..9145b44 100644
--- a/src/battle/src/Struct/Tile.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Tile.elm
@@ -1,12 +1,14 @@
-module Struct.Tile exposing
+module BattleMap.Struct.Tile exposing
(
Ref,
VariantID,
+ FamilyID,
Type,
get_id,
get_name,
get_cost,
get_omnimods,
+ get_family,
decoder
)
@@ -17,24 +19,27 @@ import Json.Decode
import Json.Decode.Pipeline
-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Local Module ----------------------------------------------------------------
import Constants.UI
import Constants.Movement
-import Struct.Location
-import Struct.Omnimods
-
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type alias Ref = String
type alias VariantID = String
+type alias FamilyID = String
type alias Type =
{
id : Ref,
name : String,
crossing_cost : Int,
- omnimods : Struct.Omnimods.Type
+ family : FamilyID,
+ depth : Int,
+ omnimods : Battle.Struct.Omnimods.Type
}
--------------------------------------------------------------------------------
@@ -53,7 +58,10 @@ get_cost tile = tile.crossing_cost
get_name : Type -> String
get_name tile = tile.name
-get_omnimods : Type -> Struct.Omnimods.Type
+get_family : Type -> FamilyID
+get_family tile = tile.family
+
+get_omnimods : Type -> Battle.Struct.Omnimods.Type
get_omnimods t = t.omnimods
decoder : (Json.Decode.Decoder Type)
@@ -63,5 +71,7 @@ decoder =
|> (Json.Decode.Pipeline.required "id" Json.Decode.string)
|> (Json.Decode.Pipeline.required "nam" Json.Decode.string)
|> (Json.Decode.Pipeline.required "ct" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
+ |> (Json.Decode.Pipeline.required "fa" Json.Decode.string)
+ |> (Json.Decode.Pipeline.required "de" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder)
)
diff --git a/src/battle/src/Struct/TileInstance.elm b/src/shared/battle-map/BattleMap/Struct/TileInstance.elm
index dba4151..8c39371 100644
--- a/src/battle/src/Struct/TileInstance.elm
+++ b/src/shared/battle-map/BattleMap/Struct/TileInstance.elm
@@ -1,12 +1,14 @@
-module Struct.TileInstance exposing
+module BattleMap.Struct.TileInstance exposing
(
Type,
Border,
clone,
get_location,
get_class_id,
+ get_family,
get_cost,
default,
+ set_borders,
get_borders,
new_border,
get_variant_id,
@@ -16,39 +18,45 @@ module Struct.TileInstance exposing
error,
solve,
set_location_from_index,
- decoder
+ decoder,
+ encode
)
-- Elm -------------------------------------------------------------------------
import Dict
+import Json.Encode
+
import Json.Decode
import Json.Decode.Pipeline
--- Battle ----------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Tile
+import BattleMap.Struct.Location
+
+-- Local -----------------------------------------------------------------------
import Constants.UI
import Constants.Movement
-import Struct.Tile
-import Struct.Location
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type alias Type =
{
- location : Struct.Location.Type,
+ location : BattleMap.Struct.Location.Type,
crossing_cost : Int,
- class_id : Struct.Tile.Ref,
- variant_id : Struct.Tile.VariantID,
+ family : BattleMap.Struct.Tile.FamilyID,
+ class_id : BattleMap.Struct.Tile.Ref,
+ variant_id : BattleMap.Struct.Tile.VariantID,
triggers : (List String),
borders : (List Border)
}
type alias Border =
{
- class_id : Struct.Tile.Ref,
- variant_id : Struct.Tile.VariantID
+ class_id : BattleMap.Struct.Tile.Ref,
+ variant_id : BattleMap.Struct.Tile.VariantID
}
--------------------------------------------------------------------------------
@@ -61,23 +69,24 @@ noise_function a b c =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-clone : Struct.Location.Type -> Type -> Type
+clone : BattleMap.Struct.Location.Type -> Type -> Type
clone loc inst = {inst | location = loc}
-new_border : Struct.Tile.Ref -> Struct.Tile.VariantID -> Border
+new_border : BattleMap.Struct.Tile.Ref -> BattleMap.Struct.Tile.VariantID -> Border
new_border class_id variant_id =
{
class_id = class_id,
variant_id = variant_id
}
-default : Struct.Tile.Type -> Type
+default : BattleMap.Struct.Tile.Type -> Type
default tile =
{
location = {x = 0, y = 0},
class_id = (Struct.Tile.get_id tile),
variant_id = "0",
crossing_cost = (Struct.Tile.get_cost tile),
+ family = (Struct.Tile.get_family tile),
triggers = [],
borders = []
}
@@ -88,27 +97,34 @@ error x y =
location = {x = x, y = y},
class_id = "0",
variant_id = "0",
+ family = "0",
crossing_cost = Constants.Movement.cost_when_out_of_bounds,
triggers = [],
borders = []
}
-get_class_id : Type -> Struct.Tile.Ref
+get_class_id : Type -> BattleMap.Struct.Tile.Ref
get_class_id inst = inst.class_id
get_cost : Type -> Int
get_cost inst = inst.crossing_cost
-get_location : Type -> Struct.Location.Type
+get_location : Type -> BattleMap.Struct.Location.Type
get_location inst = inst.location
+get_family : Type -> BattleMap.Struct.Tile.FamilyID
+get_family inst = inst.family
+
+set_borders : (List Border) -> Type -> Type
+set_borders borders tile_inst = {tile_inst | borders = borders}
+
get_borders : Type -> (List Border)
get_borders tile_inst = tile_inst.borders
-get_variant_id : Type -> Struct.Tile.VariantID
+get_variant_id : Type -> BattleMap.Struct.Tile.VariantID
get_variant_id tile_inst = tile_inst.variant_id
-get_border_variant_id : Border -> Struct.Tile.VariantID
+get_border_variant_id : Border -> BattleMap.Struct.Tile.VariantID
get_border_variant_id tile_border = tile_border.variant_id
get_local_variant_ix : Type -> Int
@@ -122,11 +138,25 @@ get_local_variant_ix tile_inst =
)
)
-solve : (Dict.Dict Struct.Tile.Ref Struct.Tile.Type) -> Type -> Type
+solve : (
+ (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type) ->
+ Type ->
+ Type
+ )
solve tiles tile_inst =
case (Dict.get tile_inst.class_id tiles) of
- (Just tile) -> {tile_inst | crossing_cost = (Struct.Tile.get_cost tile)}
- Nothing -> {tile_inst | crossing_cost = -1}
+ (Just tile) ->
+ {tile_inst |
+ crossing_cost = (Struct.Tile.get_cost tile),
+ family = (Struct.Tile.get_family tile)
+ }
+
+ Nothing ->
+ {tile_inst |
+ crossing_cost = -1,
+ family = "-1"
+ }
+
list_to_borders : (
(List String) ->
@@ -152,6 +182,7 @@ decoder =
Type
|> (Json.Decode.Pipeline.hardcoded {x = 0, y = 0}) -- Location
|> (Json.Decode.Pipeline.hardcoded 0) -- Crossing Cost
+ |> (Json.Decode.Pipeline.hardcoded "") -- Family
|> (Json.Decode.Pipeline.hardcoded tile_id)
|> (Json.Decode.Pipeline.hardcoded variant_id)
|>
@@ -169,7 +200,7 @@ decoder =
(Json.Decode.field "b" (Json.Decode.list (Json.Decode.string)))
)
-get_border_class_id : Border -> Struct.Tile.Ref
+get_border_class_id : Border -> BattleMap.Struct.Tile.Ref
get_border_class_id tile_border = tile_border.class_id
set_location_from_index : Int -> Int -> Type -> Type
@@ -181,3 +212,38 @@ set_location_from_index map_width index tile_inst =
y = (index // map_width)
}
}
+
+encode : Type -> Json.Encode.Value
+encode tile_inst =
+ (Json.Encode.object
+ [
+ (
+ "b",
+ (Json.Encode.list
+ (Json.Encode.string)
+ (
+ tile_inst.class_id
+ ::
+ (
+ tile_inst.variant_id
+ ::
+ (List.concatMap
+ (\border ->
+ [
+ border.class_id,
+ border.variant_id
+ ]
+ )
+ tile_inst.borders
+ )
+ )
+ )
+ )
+ ),
+ (
+ "t",
+ (Json.Encode.list (Json.Encode.string) tile_inst.triggers)
+ )
+ ]
+ )
+
diff --git a/src/shared/battle-map/BattleMap/View/Tile.elm b/src/shared/battle-map/BattleMap/View/Tile.elm
new file mode 100644
index 0000000..6039ff4
--- /dev/null
+++ b/src/shared/battle-map/BattleMap/View/Tile.elm
@@ -0,0 +1,242 @@
+module BattleMap.View.Tile exposing (get_html, get_html_extra, get_content_html)
+
+-- Elm -------------------------------------------------------------------------
+import Html
+import Html.Attributes
+import Html.Events
+
+-- Battle Map ------------------------------------------------------------------
+import Constants.UI
+import Constants.IO
+
+import BattleMap.Struct.Location
+import BattleMap.Struct.TileInstance
+
+-- Local -----------------------------------------------------------------------
+import Struct.Event
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_layer_html : (
+ Int ->
+ BattleMap.Struct.TileInstance.Border ->
+ (Html.Html Struct.Event.Type)
+ )
+get_layer_html index border =
+ (Html.div
+ [
+ (Html.Attributes.class ("tile-icon-f-" ++ (String.fromInt index))),
+ (Html.Attributes.style
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (BattleMap.Struct.TileInstance.get_border_class_id border)
+ ++ "-f-"
+ ++ (BattleMap.Struct.TileInstance.get_border_variant_id border)
+ ++ ".svg)"
+ )
+ )
+ ]
+ []
+ )
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_content_html : (
+ BattleMap.Struct.TileInstance.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
+get_content_html tile =
+ (
+ (Html.div
+ [
+ (Html.Attributes.class "tile-icon-bg"),
+ (Html.Attributes.style
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (BattleMap.Struct.TileInstance.get_class_id tile)
+ ++ "-bg.svg)"
+ )
+ )
+ ]
+ []
+ )
+ (Html.div
+ [
+ (Html.Attributes.class "tile-icon-bg"),
+ (Html.Attributes.style
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (BattleMap.Struct.TileInstance.get_class_id tile)
+ ++ "-bg.svg)"
+ )
+ )
+ ]
+ []
+ )
+ ::
+ (
+ (Html.div
+ [
+ (Html.Attributes.class "tile-icon-dt"),
+ (Html.Attributes.style
+ "background-image"
+ (
+ "url("
+ ++ Constants.IO.tile_assets_url
+ ++ (BattleMap.Struct.TileInstance.get_class_id tile)
+ ++ "-v-"
+ ++ (BattleMap.Struct.TileInstance.get_variant_id tile)
+ ++ ".svg)"
+ )
+ )
+ ]
+ []
+ )
+ ::
+ (List.indexedMap
+ (get_layer_html)
+ (BattleMap.Struct.TileInstance.get_borders tile)
+ )
+ )
+ )
+
+get_html : (
+ Bool ->
+ BattleMap.Struct.TileInstance.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html display_cost tile =
+ let tile_loc = (BattleMap.Struct.TileInstance.get_location tile) in
+ (Html.div
+ [
+ (Html.Attributes.class "tile-icon"),
+ (Html.Attributes.class "tiled"),
+ (Html.Attributes.class
+ (
+ "tile-variant-"
+ ++
+ (String.fromInt
+ (BattleMap.Struct.TileInstance.get_local_variant_ix tile)
+ )
+ )
+ ),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TileSelected
+ (BattleMap.Struct.Location.get_ref tile_loc)
+ )
+ ),
+ (Html.Attributes.style
+ "top"
+ (
+ (String.fromInt (tile_loc.y * Constants.UI.tile_size))
+ ++ "px"
+ )
+ ),
+ (Html.Attributes.style
+ "left"
+ (
+ (String.fromInt (tile_loc.x * Constants.UI.tile_size))
+ ++ "px"
+ )
+ )
+ ]
+ (
+ if (display_cost)
+ then
+ (
+ (Html.div
+ [
+ (Html.Attributes.class "tile-icon-cost")
+ ]
+ [
+ (Html.text
+ (String.fromInt
+ (BattleMap.Struct.TileInstance.get_cost tile)
+ )
+ )
+ ]
+ )
+ :: (get_content_html tile)
+ )
+ else (get_content_html tile)
+ )
+ )
+
+get_html_with_extra : (
+ Bool ->
+ (List Html.Attributes.Attribute) ->
+ BattleMap.Struct.TileInstance.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html_with_extra display_cost extra_classes tile =
+ let tile_loc = (BattleMap.Struct.TileInstance.get_location tile) in
+ (Html.div
+ (
+ extra_classes
+ ++
+ [
+ (Html.Attributes.class "tile-icon"),
+ (Html.Attributes.class "tiled"),
+ (Html.Attributes.class
+ (
+ "tile-variant-"
+ ++
+ (String.fromInt
+ (BattleMap.Struct.TileInstance.get_local_variant_ix
+ tile
+ )
+ )
+ )
+ ),
+ (Html.Attributes.class "clickable"),
+ (Html.Events.onClick
+ (Struct.Event.TileSelected
+ (BattleMap.Struct.Location.get_ref tile_loc)
+ )
+ ),
+ (Html.Attributes.style
+ "top"
+ (
+ (String.fromInt (tile_loc.y * Constants.UI.tile_size))
+ ++ "px"
+ )
+ ),
+ (Html.Attributes.style
+ "left"
+ (
+ (String.fromInt (tile_loc.x * Constants.UI.tile_size))
+ ++ "px"
+ )
+ )
+ ]
+ )
+ (
+ if (display_cost)
+ then
+ (
+ (Html.div
+ [
+ (Html.Attributes.class "tile-icon-cost")
+ ]
+ [
+ (Html.text
+ (String.fromInt
+ (BattleMap.Struct.TileInstance.get_cost tile)
+ )
+ )
+ ]
+ )
+ :: (get_content_html tile)
+ )
+ else (get_content_html tile)
+ )
+ )
diff --git a/src/roster-editor/src/Struct/Attributes.elm b/src/shared/battle/Battle/Struct/Attributes.elm
index ce871dd..ee12dbd 100644
--- a/src/roster-editor/src/Struct/Attributes.elm
+++ b/src/shared/battle/Battle/Struct/Attributes.elm
@@ -1,4 +1,4 @@
-module Struct.Attributes exposing
+module Battle.Struct.Attributes exposing
(
Type,
Category(..),
@@ -21,10 +21,6 @@ module Struct.Attributes exposing
default
)
--- Elm -------------------------------------------------------------------------
-
--- Battle ----------------------------------------------------------------------
-
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
diff --git a/src/battle/src/Struct/DamageType.elm b/src/shared/battle/Battle/Struct/DamageType.elm
index b7bced7..59ab19e 100644
--- a/src/battle/src/Struct/DamageType.elm
+++ b/src/shared/battle/Battle/Struct/DamageType.elm
@@ -1,4 +1,4 @@
-module Struct.DamageType exposing
+module Battle.Struct.DamageType exposing
(
Type(..),
encode,
@@ -8,7 +8,7 @@ module Struct.DamageType exposing
-- Elm -------------------------------------------------------------------------
--- Map -------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
diff --git a/src/battle/src/Struct/Omnimods.elm b/src/shared/battle/Battle/Struct/Omnimods.elm
index 4ee72b2..46843b2 100644
--- a/src/battle/src/Struct/Omnimods.elm
+++ b/src/shared/battle/Battle/Struct/Omnimods.elm
@@ -1,4 +1,4 @@
-module Struct.Omnimods exposing
+module Battle.Struct.Omnimods exposing
(
Type,
new,
@@ -20,10 +20,10 @@ import Dict
import Json.Decode
import Json.Decode.Pipeline
--- Map -------------------------------------------------------------------
-import Struct.Attributes
-import Struct.Statistics
-import Struct.DamageType
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Attributes
+import Battle.Struct.Statistics
+import Battle.Struct.DamageType
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -112,18 +112,18 @@ merge omni_a omni_b =
defense = (merge_mods omni_a.defense omni_b.defense)
}
-apply_to_attributes : Type -> Struct.Attributes.Type -> Struct.Attributes.Type
+apply_to_attributes : Type -> Battle.Struct.Attributes.Type -> Battle.Struct.Attributes.Type
apply_to_attributes omnimods attributes =
(Dict.foldl
- ((Struct.Attributes.decode_category) >> (Struct.Attributes.mod))
+ ((Battle.Struct.Attributes.decode_category) >> (Battle.Struct.Attributes.mod))
attributes
omnimods.attributes
)
-apply_to_statistics : Type -> Struct.Statistics.Type -> Struct.Statistics.Type
+apply_to_statistics : Type -> Battle.Struct.Statistics.Type -> Battle.Struct.Statistics.Type
apply_to_statistics omnimods statistics =
(Dict.foldl
- ((Struct.Statistics.decode_category) >> (Struct.Statistics.mod))
+ ((Battle.Struct.Statistics.decode_category) >> (Battle.Struct.Statistics.mod))
statistics
omnimods.statistics
)
@@ -139,7 +139,7 @@ get_attack_damage dmg_modifier atk_omni def_omni =
(
case
(Dict.get
- (Struct.DamageType.encode Struct.DamageType.Base)
+ (Battle.Struct.DamageType.encode Battle.Struct.DamageType.Base)
def_omni.defense
)
of
diff --git a/src/battle/src/Struct/Statistics.elm b/src/shared/battle/Battle/Struct/Statistics.elm
index f676648..e21b4f6 100644
--- a/src/battle/src/Struct/Statistics.elm
+++ b/src/shared/battle/Battle/Struct/Statistics.elm
@@ -1,4 +1,4 @@
-module Struct.Statistics exposing
+module Battle.Struct.Statistics exposing
(
Type,
Category(..),
@@ -19,7 +19,7 @@ module Struct.Statistics exposing
import List
-- Battle ----------------------------------------------------------------------
-import Struct.Attributes
+import Battle.Struct.Attributes
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -168,15 +168,15 @@ mod cat v t =
DoubleHits -> (mod_double_hits v t)
CriticalHits -> (mod_critical_hits v t)
-new_raw : (Struct.Attributes.Type -> Type)
+new_raw : (Battle.Struct.Attributes.Type -> Type)
new_raw att =
let
- constitution = (Struct.Attributes.get_constitution att)
- dexterity = (Struct.Attributes.get_dexterity att)
- intelligence = (Struct.Attributes.get_intelligence att)
- mind = (Struct.Attributes.get_mind att)
- speed = (Struct.Attributes.get_speed att)
- strength = (Struct.Attributes.get_strength att)
+ constitution = (Battle.Struct.Attributes.get_constitution att)
+ dexterity = (Battle.Struct.Attributes.get_dexterity att)
+ intelligence = (Battle.Struct.Attributes.get_intelligence att)
+ mind = (Battle.Struct.Attributes.get_mind att)
+ speed = (Battle.Struct.Attributes.get_speed att)
+ strength = (Battle.Struct.Attributes.get_strength att)
in
{
movement_points =
diff --git a/src/shared/battle/Battle/View/Omnimods.elm b/src/shared/battle/Battle/View/Omnimods.elm
new file mode 100644
index 0000000..a946c35
--- /dev/null
+++ b/src/shared/battle/Battle/View/Omnimods.elm
@@ -0,0 +1,181 @@
+module Battle.View.Omnimods exposing
+ (
+ get_html_with_modifier,
+ get_html
+ )
+
+-- Elm -------------------------------------------------------------------------
+import List
+
+import Html
+import Html.Attributes
+import Html.Events
+
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Local Module ----------------------------------------------------------------
+import Struct.Event
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_mod_html : (String, Int) -> (Html.Html Struct.Event.Type)
+get_mod_html mod =
+ let
+ (category, value) = mod
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "info-card-mod")
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class ("omnimod-icon-" ++ category)),
+ (
+ if (value < 0)
+ then (Html.Attributes.class "omnimod-icon-negative")
+ else (Html.Attributes.class "omnimod-icon-positive")
+ )
+ ]
+ [
+ ]
+ ),
+ (Html.text (String.fromInt value))
+ ]
+ )
+
+get_multiplied_mod_html : Float -> (String, Int) -> (Html.Html Struct.Event.Type)
+get_multiplied_mod_html multiplier mod =
+ let
+ (category, value) = mod
+ in
+ (Html.div
+ [
+ (Html.Attributes.class "character-card-mod")
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-icon"),
+ (Html.Attributes.class ("omnimod-icon-" ++ category)),
+ (
+ if (value < 0)
+ then (Html.Attributes.class "omnimod-icon-negative")
+ else (Html.Attributes.class "omnimod-icon-positive")
+ )
+ ]
+ [
+ ]
+ ),
+ (Html.text
+ (
+ (String.fromInt value)
+ ++ " ("
+ ++(String.fromInt (ceiling ((toFloat value) * multiplier)))
+ ++ ")"
+ )
+ )
+ ]
+ )
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+get_html_with_modifier : (
+ Float ->
+ Battle.Struct.Omnimods.Type ->
+ (Html.Html Struct.Event.Type)
+ )
+get_html_with_modifier attack_multiplier omnimods =
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-listing")
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-attack-mods")
+ ]
+ (List.map
+ (get_multiplied_mod_html attack_multiplier)
+ (Battle.Struct.Omnimods.get_attack_mods omnimods)
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-defense-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_defense_mods omnimods)
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-attribute-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_attributes_mods omnimods)
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-statistics-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_statistics_mods omnimods)
+ )
+ )
+ ]
+ )
+
+get_html : Battle.Struct.Omnimods.Type -> (Html.Html Struct.Event.Type)
+get_html omnimods =
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-listing")
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-attack-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_attack_mods omnimods)
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-defense-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_defense_mods omnimods)
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-attribute-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_attributes_mods omnimods)
+ )
+ ),
+ (Html.div
+ [
+ (Html.Attributes.class "omnimod-statistics-mods")
+ ]
+ (List.map
+ (get_mod_html)
+ (Battle.Struct.Omnimods.get_statistics_mods omnimods)
+ )
+ )
+ ]
+ )