summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-03-15 23:10:22 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-03-15 23:10:22 +0100
commita3c380b2813c9928a2ee600c276295c7803e9e66 (patch)
tree825d2ce62f4bb223bd26e9441f266a29fa61f0d0
parent0a2aa713a3e9babfeab8be394cd7066265184458 (diff)
Got everything to compile again.
-rw-r--r--src/map-editor/src/Comm/AddTile.elm10
-rw-r--r--src/map-editor/src/Comm/AddTilePattern.elm2
-rw-r--r--src/map-editor/src/Comm/LoadMap.elm2
-rw-r--r--src/map-editor/src/Comm/LoadTilePatterns.elm4
-rw-r--r--src/map-editor/src/Comm/LoadTiles.elm4
-rw-r--r--src/map-editor/src/Comm/Okay.elm2
-rw-r--r--src/map-editor/src/Comm/Send.elm2
-rw-r--r--src/map-editor/src/Comm/SendMapUpdate.elm19
-rw-r--r--src/map-editor/src/Comm/SetMap.elm8
-rw-r--r--src/map-editor/src/ElmModule/Init.elm6
-rw-r--r--src/map-editor/src/ElmModule/Subscriptions.elm4
-rw-r--r--src/map-editor/src/ElmModule/Update.elm4
-rw-r--r--src/map-editor/src/ElmModule/View.elm2
-rw-r--r--src/map-editor/src/Main.elm6
-rw-r--r--src/map-editor/src/Struct/Attributes.elm173
-rw-r--r--src/map-editor/src/Struct/DamageType.elm55
-rw-r--r--src/map-editor/src/Struct/Direction.elm52
-rw-r--r--src/map-editor/src/Struct/Event.elm13
-rw-r--r--src/map-editor/src/Struct/HelpRequest.elm4
-rw-r--r--src/map-editor/src/Struct/Location.elm99
-rw-r--r--src/map-editor/src/Struct/Map.elm156
-rw-r--r--src/map-editor/src/Struct/MapMarker.elm97
-rw-r--r--src/map-editor/src/Struct/Model.elm53
-rw-r--r--src/map-editor/src/Struct/Omnimods.elm91
-rw-r--r--src/map-editor/src/Struct/ServerReply.elm12
-rw-r--r--src/map-editor/src/Struct/Statistics.elm210
-rw-r--r--src/map-editor/src/Struct/Tile.elm77
-rw-r--r--src/map-editor/src/Struct/TileInstance.elm245
-rw-r--r--src/map-editor/src/Struct/TilePattern.elm16
-rw-r--r--src/map-editor/src/Struct/Toolbox.elm84
-rw-r--r--src/map-editor/src/Struct/UI.elm10
-rw-r--r--src/map-editor/src/Update/ChangeScale.elm3
-rw-r--r--src/map-editor/src/Update/ClearToolboxSelection.elm3
-rw-r--r--src/map-editor/src/Update/GoToMainMenu.elm4
-rw-r--r--src/map-editor/src/Update/HandleServerReply.elm21
-rw-r--r--src/map-editor/src/Update/PrettifySelectedTiles.elm67
-rw-r--r--src/map-editor/src/Update/SelectTab.elm3
-rw-r--r--src/map-editor/src/Update/SelectTile.elm10
-rw-r--r--src/map-editor/src/Update/SendMapUpdate.elm2
-rw-r--r--src/map-editor/src/Update/SetRequestedHelp.elm3
-rw-r--r--src/map-editor/src/Update/SetToolboxMode.elm3
-rw-r--r--src/map-editor/src/Update/SetToolboxShape.elm3
-rw-r--r--src/map-editor/src/Update/SetToolboxTemplate.elm10
-rw-r--r--src/map-editor/src/View/MainMenu.elm2
-rw-r--r--src/map-editor/src/View/Map.elm18
-rw-r--r--src/map-editor/src/View/Map/Tile.elm54
-rw-r--r--src/map-editor/src/View/MessageBoard.elm2
-rw-r--r--src/map-editor/src/View/MessageBoard/Error.elm2
-rw-r--r--src/map-editor/src/View/MessageBoard/Help.elm2
-rw-r--r--src/map-editor/src/View/MessageBoard/Help/Guide.elm2
-rw-r--r--src/map-editor/src/View/SubMenu.elm7
-rw-r--r--src/map-editor/src/View/SubMenu/Markers.elm27
-rw-r--r--src/map-editor/src/View/SubMenu/Settings.elm2
-rw-r--r--src/map-editor/src/View/SubMenu/TileStatus.elm77
-rw-r--r--src/map-editor/src/View/SubMenu/Tiles.elm22
-rw-r--r--src/map-editor/src/View/Toolbox.elm19
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Location.elm31
57 files changed, 345 insertions, 1576 deletions
diff --git a/src/map-editor/src/Comm/AddTile.elm b/src/map-editor/src/Comm/AddTile.elm
index d0a3ce8..797731b 100644
--- a/src/map-editor/src/Comm/AddTile.elm
+++ b/src/map-editor/src/Comm/AddTile.elm
@@ -3,8 +3,10 @@ module Comm.AddTile exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Battlemap -------------------------------------------------------------------
-import Struct.Tile
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
@@ -14,11 +16,11 @@ import Struct.ServerReply
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-internal_decoder : Struct.Tile.Type -> Struct.ServerReply.Type
+internal_decoder : BattleMap.Struct.Tile.Type -> Struct.ServerReply.Type
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/map-editor/src/Comm/AddTilePattern.elm b/src/map-editor/src/Comm/AddTilePattern.elm
index bf9b15d..603e743 100644
--- a/src/map-editor/src/Comm/AddTilePattern.elm
+++ b/src/map-editor/src/Comm/AddTilePattern.elm
@@ -3,7 +3,7 @@ module Comm.AddTilePattern exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.TilePattern
import Struct.ServerReply
diff --git a/src/map-editor/src/Comm/LoadMap.elm b/src/map-editor/src/Comm/LoadMap.elm
index 2d53e80..b420d26 100644
--- a/src/map-editor/src/Comm/LoadMap.elm
+++ b/src/map-editor/src/Comm/LoadMap.elm
@@ -3,7 +3,7 @@ module Comm.LoadMap exposing (try)
-- Elm -------------------------------------------------------------------------
import Json.Encode
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.Send
import Constants.IO
diff --git a/src/map-editor/src/Comm/LoadTilePatterns.elm b/src/map-editor/src/Comm/LoadTilePatterns.elm
index b730642..d50c686 100644
--- a/src/map-editor/src/Comm/LoadTilePatterns.elm
+++ b/src/map-editor/src/Comm/LoadTilePatterns.elm
@@ -1,8 +1,6 @@
module Comm.LoadTilePatterns exposing (try)
--- Elm -------------------------------------------------------------------------
-
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.Send
import Constants.IO
diff --git a/src/map-editor/src/Comm/LoadTiles.elm b/src/map-editor/src/Comm/LoadTiles.elm
index 6175e7a..6632d18 100644
--- a/src/map-editor/src/Comm/LoadTiles.elm
+++ b/src/map-editor/src/Comm/LoadTiles.elm
@@ -1,8 +1,6 @@
module Comm.LoadTiles exposing (try)
--- Elm -------------------------------------------------------------------------
-
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.Send
import Constants.IO
diff --git a/src/map-editor/src/Comm/Okay.elm b/src/map-editor/src/Comm/Okay.elm
index ca7a2eb..3d29375 100644
--- a/src/map-editor/src/Comm/Okay.elm
+++ b/src/map-editor/src/Comm/Okay.elm
@@ -3,7 +3,7 @@ module Comm.Okay exposing (decode)
-- Elm -------------------------------------------------------------------------
import Json.Decode
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.ServerReply
--------------------------------------------------------------------------------
diff --git a/src/map-editor/src/Comm/Send.elm b/src/map-editor/src/Comm/Send.elm
index 4371b07..c7b2f39 100644
--- a/src/map-editor/src/Comm/Send.elm
+++ b/src/map-editor/src/Comm/Send.elm
@@ -6,7 +6,7 @@ import Http
import Json.Decode
import Json.Encode
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.AddTile
import Comm.AddTilePattern
import Comm.Okay
diff --git a/src/map-editor/src/Comm/SendMapUpdate.elm b/src/map-editor/src/Comm/SendMapUpdate.elm
index d2ae2c9..023f24c 100644
--- a/src/map-editor/src/Comm/SendMapUpdate.elm
+++ b/src/map-editor/src/Comm/SendMapUpdate.elm
@@ -5,15 +5,17 @@ import Array
import Json.Encode
--- Map -------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+import BattleMap.Struct.TileInstance
+
+-- Local Module ----------------------------------------------------------------
import Constants.IO
import Comm.Send
import Struct.Event
-import Struct.Map
import Struct.Model
-import Struct.TileInstance
--------------------------------------------------------------------------------
-- TYPES ------------------------------------------------------------------------
@@ -30,13 +32,16 @@ encode_map model =
("stk", (Json.Encode.string model.session_token)),
("pid", (Json.Encode.string model.player_id)),
("mid", (Json.Encode.string model.map_id)),
- ("w", (Json.Encode.int (Struct.Map.get_width model.map))),
- ("h", (Json.Encode.int (Struct.Map.get_height model.map))),
+ ("w", (Json.Encode.int (BattleMap.Struct.Map.get_width model.map))),
+ (
+ "h",
+ (Json.Encode.int (BattleMap.Struct.Map.get_height model.map))
+ ),
(
"t",
(Json.Encode.list
- (Struct.TileInstance.encode)
- (Array.toList (Struct.Map.get_tiles model.map))
+ (BattleMap.Struct.TileInstance.encode)
+ (Array.toList (BattleMap.Struct.Map.get_tiles model.map))
)
)
]
diff --git a/src/map-editor/src/Comm/SetMap.elm b/src/map-editor/src/Comm/SetMap.elm
index 10d527a..80f6db1 100644
--- a/src/map-editor/src/Comm/SetMap.elm
+++ b/src/map-editor/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/map-editor/src/ElmModule/Init.elm b/src/map-editor/src/ElmModule/Init.elm
index 40e49b3..eb1fd2a 100644
--- a/src/map-editor/src/ElmModule/Init.elm
+++ b/src/map-editor/src/ElmModule/Init.elm
@@ -1,14 +1,14 @@
module ElmModule.Init exposing (init)
--- Elm -------------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Struct.Flags
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.LoadTilePatterns
import Comm.LoadTiles
import Comm.LoadMap
import Struct.Event
-import Struct.Flags
import Struct.Model
--------------------------------------------------------------------------------
diff --git a/src/map-editor/src/ElmModule/Subscriptions.elm b/src/map-editor/src/ElmModule/Subscriptions.elm
index f342b30..c2b9fbe 100644
--- a/src/map-editor/src/ElmModule/Subscriptions.elm
+++ b/src/map-editor/src/ElmModule/Subscriptions.elm
@@ -1,8 +1,6 @@
module ElmModule.Subscriptions exposing (..)
--- Elm -------------------------------------------------------------------------
-
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
diff --git a/src/map-editor/src/ElmModule/Update.elm b/src/map-editor/src/ElmModule/Update.elm
index 850e659..095c049 100644
--- a/src/map-editor/src/ElmModule/Update.elm
+++ b/src/map-editor/src/ElmModule/Update.elm
@@ -1,8 +1,6 @@
module ElmModule.Update exposing (update)
--- Elm -------------------------------------------------------------------------
-
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
diff --git a/src/map-editor/src/ElmModule/View.elm b/src/map-editor/src/ElmModule/View.elm
index 5c85fc0..7226222 100644
--- a/src/map-editor/src/ElmModule/View.elm
+++ b/src/map-editor/src/ElmModule/View.elm
@@ -5,7 +5,7 @@ import Html
import Html.Lazy
import Html.Attributes
--- Battlemap -------------------------------------------------------------------
+-- Local Module-------------------------------------------------------------------
import Constants.UI
import Struct.Event
diff --git a/src/map-editor/src/Main.elm b/src/map-editor/src/Main.elm
index e404695..bd497ba 100644
--- a/src/map-editor/src/Main.elm
+++ b/src/map-editor/src/Main.elm
@@ -1,10 +1,12 @@
-- Elm ------------------------------------------------------------------------
import Browser
--- Map Editor ------------------------------------------------------------------
+-- 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/map-editor/src/Struct/Attributes.elm b/src/map-editor/src/Struct/Attributes.elm
deleted file mode 100644
index ce871dd..0000000
--- a/src/map-editor/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/map-editor/src/Struct/DamageType.elm b/src/map-editor/src/Struct/DamageType.elm
deleted file mode 100644
index b7bced7..0000000
--- a/src/map-editor/src/Struct/DamageType.elm
+++ /dev/null
@@ -1,55 +0,0 @@
-module Struct.DamageType exposing
- (
- Type(..),
- encode,
- decode,
- to_string
- )
-
--- Elm -------------------------------------------------------------------------
-
--- Map -------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type Type =
- Base
- | Slash
- | Blunt
- | Pierce
- | None
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- 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"
diff --git a/src/map-editor/src/Struct/Direction.elm b/src/map-editor/src/Struct/Direction.elm
deleted file mode 100644
index 600138c..0000000
--- a/src/map-editor/src/Struct/Direction.elm
+++ /dev/null
@@ -1,52 +0,0 @@
-module Struct.Direction exposing (Type(..), opposite_of, to_string, decoder)
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-
--- Battlemap -------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type Type =
- None
- | Left
- | Right
- | Up
- | Down
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-from_string : String -> Type
-from_string str =
- case str of
- "R" -> Right
- "L" -> Left
- "U" -> Up
- "D" -> Down
- _ -> None
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-opposite_of : Type -> Type
-opposite_of d =
- case d of
- Left -> Right
- Right -> Left
- Up -> Down
- Down -> Up
- None -> None
-
-to_string : Type -> String
-to_string dir =
- case dir of
- Right -> "R"
- Left -> "L"
- Up -> "U"
- Down -> "D"
- None -> "N"
-
-decoder : (Json.Decode.Decoder Type)
-decoder = (Json.Decode.map (from_string) Json.Decode.string)
diff --git a/src/map-editor/src/Struct/Event.elm b/src/map-editor/src/Struct/Event.elm
index 3ea77bc..fd7a1ee 100644
--- a/src/map-editor/src/Struct/Event.elm
+++ b/src/map-editor/src/Struct/Event.elm
@@ -3,12 +3,14 @@ module Struct.Event exposing (Type(..), attempted)
-- Elm -------------------------------------------------------------------------
import Http
--- Battlemap -------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Error
import Struct.HelpRequest
-import Struct.Location
import Struct.ServerReply
-import Struct.Tile
import Struct.Toolbox
import Struct.UI
@@ -21,12 +23,13 @@ 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
| RequestedHelp Struct.HelpRequest.Type
| ModeRequested Struct.Toolbox.Mode
| ShapeRequested Struct.Toolbox.Shape
| ClearSelectionRequested
- | TemplateRequested (Struct.Tile.Ref, Struct.Tile.VariantID)
+ | TemplateRequested
+ (BattleMap.Struct.Tile.Ref, BattleMap.Struct.Tile.VariantID)
| PrettifySelectionRequested
| SendMapUpdateRequested
| GoToMainMenu
diff --git a/src/map-editor/src/Struct/HelpRequest.elm b/src/map-editor/src/Struct/HelpRequest.elm
index 61bf3aa..50d2ee6 100644
--- a/src/map-editor/src/Struct/HelpRequest.elm
+++ b/src/map-editor/src/Struct/HelpRequest.elm
@@ -1,9 +1,5 @@
module Struct.HelpRequest exposing (Type(..))
--- Elm -------------------------------------------------------------------------
-
--- Map Editor ------------------------------------------------------------------
-
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
diff --git a/src/map-editor/src/Struct/Location.elm b/src/map-editor/src/Struct/Location.elm
deleted file mode 100644
index dd66c5c..0000000
--- a/src/map-editor/src/Struct/Location.elm
+++ /dev/null
@@ -1,99 +0,0 @@
-module Struct.Location exposing (..)
-
--- Elm -------------------------------------------------------------------------
-import Json.Decode
-import Json.Decode.Pipeline
-
-import Json.Encode
-
--- Map Editor ------------------------------------------------------------------
-import Struct.Direction
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- x : Int,
- y : Int
- }
-
-type alias Ref = (Int, Int)
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-new : Int -> Int -> Type
-new x y =
- {
- x = x,
- y = y
- }
-
-neighbor : 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
-
-neighbors : Type -> (List Type)
-neighbors loc =
- [
- {loc | x = (loc.x + 1)},
- {loc | x = (loc.x - 1)},
- {loc | y = (loc.y - 1)},
- {loc | y = (loc.y + 1)}
- ]
-
-get_full_neighborhood : Type -> (List Type)
-get_full_neighborhood loc =
- [
- {loc | x = (loc.x - 1), y = (loc.y - 1)},
- {loc | y = (loc.y - 1)},
- {loc | x = (loc.x + 1), y = (loc.y - 1)},
- {loc | x = (loc.x - 1)},
- {loc | x = (loc.x + 1)},
- {loc | x = (loc.x - 1), y = (loc.y + 1)},
- {loc | y = (loc.y + 1)},
- {loc | x = (loc.x + 1), y = (loc.y + 1)}
- ]
-
-get_ref : Type -> Ref
-get_ref l =
- (l.x, l.y)
-
-from_ref : Ref -> Type
-from_ref (x, y) =
- {x = x, y = y}
-
-dist : Type -> Type -> Int
-dist loc_a loc_b =
- (
- (abs (loc_a.x - loc_b.x))
- +
- (abs (loc_a.y - loc_b.y))
- )
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.succeed
- Type
- |> (Json.Decode.Pipeline.required "x" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "y" Json.Decode.int)
- )
-
-encode : Type -> Json.Encode.Value
-encode loc =
- (Json.Encode.object
- [
- ( "x", (Json.Encode.int loc.x) ),
- ( "y", (Json.Encode.int loc.y) )
- ]
- )
diff --git a/src/map-editor/src/Struct/Map.elm b/src/map-editor/src/Struct/Map.elm
deleted file mode 100644
index 9a09d17..0000000
--- a/src/map-editor/src/Struct/Map.elm
+++ /dev/null
@@ -1,156 +0,0 @@
-module Struct.Map exposing
- (
- Type,
- empty,
- new,
- get_width,
- get_height,
- get_markers,
- get_tiles,
- set_tile_to,
- solve_tiles,
- get_omnimods_at,
- try_getting_tile_at,
- decoder
- )
-
--- Elm -------------------------------------------------------------------------
-import Array
-
-import Dict
-
-import Json.Decode
-
--- Map Editor ------------------------------------------------------------------
-import Struct.Location
-import Struct.MapMarker
-import Struct.Omnimods
-import Struct.Tile
-import Struct.TileInstance
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- width : Int,
- height : Int,
- content : (Array.Array Struct.TileInstance.Type),
- markers : (Dict.Dict String Struct.MapMarker.Type)
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-location_to_index : Struct.Location.Type -> Type -> Int
-location_to_index loc map =
- ((loc.y * map.width) + loc.x)
-
-has_location : 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 Struct.TileInstance.Type)
-get_tiles map = map.content
-
-get_markers : Type -> (Dict.Dict String Struct.MapMarker.Type)
-get_markers map = map.markers
-
-set_tile_to : Struct.Location.Type -> 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 Struct.TileInstance.Type) -> Type
-new width height tiles =
- {
- width = width,
- height = height,
- content = (Array.fromList tiles),
- markers = (Dict.empty)
- }
-
-try_getting_tile_at : (
- Struct.Location.Type ->
- Type ->
- (Maybe 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 Struct.Tile.Ref Struct.Tile.Type) -> Type -> Type
-solve_tiles tiles map =
- {map |
- content = (Array.map (Struct.TileInstance.solve tiles) map.content)
- }
-
-get_omnimods_at : (
- Struct.Location.Type ->
- (Dict.Dict Struct.Tile.Ref Struct.Tile.Type) ->
- Type ->
- Struct.Omnimods.Type
- )
-get_omnimods_at loc tiles_solver map =
- case (try_getting_tile_at loc map) of
- Nothing -> (Struct.Omnimods.none)
- (Just tile_inst) ->
- case
- (Dict.get (Struct.TileInstance.get_class_id tile_inst) tiles_solver)
- of
- Nothing -> (Struct.Omnimods.none)
- (Just tile) -> (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
- (Struct.TileInstance.set_location_from_index width)
- )
- (Json.Decode.array (Struct.TileInstance.decoder))
- )
- )
- (Json.Decode.field
- "m"
- (Json.Decode.map
- (Dict.fromList)
- (Json.Decode.keyValuePairs (Struct.MapMarker.decoder))
- )
- )
- )
- )
- (Json.Decode.field "w" Json.Decode.int)
- )
diff --git a/src/map-editor/src/Struct/MapMarker.elm b/src/map-editor/src/Struct/MapMarker.elm
deleted file mode 100644
index 7f4799c..0000000
--- a/src/map-editor/src/Struct/MapMarker.elm
+++ /dev/null
@@ -1,97 +0,0 @@
-module Struct.MapMarker exposing
- (
- Type,
- new,
- get_locations,
- is_in_locations,
- decoder,
- encode
- )
-
--- Elm -------------------------------------------------------------------------
-import Set
-import Json.Decode
-import Json.Encode
-import List
-
--- Map Editor ------------------------------------------------------------------
-import Struct.Location
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- permissions : (Set.Set String),
- locations : (Set.Set Struct.Location.Ref)
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-
-new : Type
-new =
- {
- permissions = (Set.empty),
- locations = (Set.empty)
- }
-
-get_locations : Type -> (Set.Set Struct.Location.Ref)
-get_locations marker = marker.locations
-
-is_in_locations : Struct.Location.Ref -> Type -> Bool
-is_in_locations loc_ref marker =
- (Set.member loc_ref marker.locations)
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.map2
- Type
- (Json.Decode.field
- "p"
- (Json.Decode.map
- (Set.fromList)
- (Json.Decode.list (Json.Decode.string))
- )
- )
- (Json.Decode.field
- "l"
- (Json.Decode.map
- (Set.fromList)
- (Json.Decode.list
- (Json.Decode.map
- (Struct.Location.get_ref)
- (Struct.Location.decoder)
- )
- )
- )
- )
- )
-
-encode : Type -> Json.Encode.Value
-encode marker =
- (Json.Encode.object
- [
- (
- "p",
- (Json.Encode.list
- (Json.Encode.string)
- (Set.toList marker.permissions)
- )
- ),
- (
- "l",
- (Json.Encode.list
- (\e ->
- (Struct.Location.encode (Struct.Location.from_ref e))
- )
- (Set.toList marker.locations)
- )
- )
- ]
- )
diff --git a/src/map-editor/src/Struct/Model.elm b/src/map-editor/src/Struct/Model.elm
index 419a0e9..f5fb55e 100644
--- a/src/map-editor/src/Struct/Model.elm
+++ b/src/map-editor/src/Struct/Model.elm
@@ -16,13 +16,17 @@ import Dict
-- Shared ----------------------------------------------------------------------
import Struct.Flags
--- Map Editor ------------------------------------------------------------------
+-- Battle ----------------------------------------------------------------------
+import Battle.Struct.Omnimods
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Error
import Struct.HelpRequest
-import Struct.Location
-import Struct.Map
-import Struct.Omnimods
-import Struct.Tile
import Struct.TilePattern
import Struct.Toolbox
import Struct.UI
@@ -32,22 +36,22 @@ import Struct.UI
--------------------------------------------------------------------------------
type alias Type =
{
- flags: Struct.Flags.Type,
- toolbox: Struct.Toolbox.Type,
- help_request: Struct.HelpRequest.Type,
- map: Struct.Map.Type,
- tile_patterns:
+ flags : Struct.Flags.Type,
+ toolbox : Struct.Toolbox.Type,
+ help_request : Struct.HelpRequest.Type,
+ map : BattleMap.Struct.Map.Type,
+ tile_patterns :
(Dict.Dict
Struct.TilePattern.Actual
- Struct.Tile.VariantID
+ BattleMap.Struct.Tile.VariantID
),
- wild_tile_patterns: (List Struct.TilePattern.Type),
- tiles: (Dict.Dict Struct.Tile.Ref Struct.Tile.Type),
- error: (Maybe Struct.Error.Type),
- player_id: String,
- map_id: String,
- session_token: String,
- ui: Struct.UI.Type
+ wild_tile_patterns : (List Struct.TilePattern.Type),
+ tiles : (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type),
+ error : (Maybe Struct.Error.Type),
+ player_id : String,
+ map_id : String,
+ session_token : String,
+ ui : Struct.UI.Type
}
--------------------------------------------------------------------------------
@@ -57,9 +61,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 =
@@ -70,7 +77,7 @@ new flags =
flags = flags,
toolbox = (Struct.Toolbox.default),
help_request = Struct.HelpRequest.None,
- map = (Struct.Map.empty),
+ map = (BattleMap.Struct.Map.empty),
tiles = (Dict.empty),
tile_patterns = (Dict.empty),
wild_tile_patterns = [],
@@ -98,12 +105,12 @@ new flags =
(Just id) -> {model | map_id = id}
-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
)
diff --git a/src/map-editor/src/Struct/Omnimods.elm b/src/map-editor/src/Struct/Omnimods.elm
deleted file mode 100644
index 80fc509..0000000
--- a/src/map-editor/src/Struct/Omnimods.elm
+++ /dev/null
@@ -1,91 +0,0 @@
-module Struct.Omnimods exposing
- (
- Type,
- none,
- get_attributes_mods,
- get_statistics_mods,
- get_attack_mods,
- get_defense_mods,
- decoder
- )
-
--- Elm -------------------------------------------------------------------------
-import Dict
-
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Map Editor ------------------------------------------------------------------
-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)
- (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)
- )
- )
- )
- )
-
---------------------------------------------------------------------------------
--- 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)
- )
-
-none : Type
-none =
- let empty_dict = (Dict.empty) in
- {
- attributes = empty_dict,
- statistics = empty_dict,
- attack = empty_dict,
- defense = empty_dict
- }
-
-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)
diff --git a/src/map-editor/src/Struct/ServerReply.elm b/src/map-editor/src/Struct/ServerReply.elm
index e3116fe..079b472 100644
--- a/src/map-editor/src/Struct/ServerReply.elm
+++ b/src/map-editor/src/Struct/ServerReply.elm
@@ -1,10 +1,10 @@
module Struct.ServerReply exposing (Type(..))
--- Elm -------------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
--- Map Editor ------------------------------------------------------------------
-import Struct.Map
-import Struct.Tile
+-- Local Module ----------------------------------------------------------------
import Struct.TilePattern
--------------------------------------------------------------------------------
@@ -14,9 +14,9 @@ import Struct.TilePattern
type Type =
Okay
| Disconnected
- | AddTile Struct.Tile.Type
+ | AddTile BattleMap.Struct.Tile.Type
| AddTilePattern Struct.TilePattern.Type
- | SetMap Struct.Map.Type
+ | SetMap BattleMap.Struct.Map.Type
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
diff --git a/src/map-editor/src/Struct/Statistics.elm b/src/map-editor/src/Struct/Statistics.elm
deleted file mode 100644
index f676648..0000000
--- a/src/map-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/map-editor/src/Struct/Tile.elm b/src/map-editor/src/Struct/Tile.elm
deleted file mode 100644
index cafcf03..0000000
--- a/src/map-editor/src/Struct/Tile.elm
+++ /dev/null
@@ -1,77 +0,0 @@
-module Struct.Tile exposing
- (
- Ref,
- VariantID,
- FamilyID,
- Type,
- get_id,
- get_name,
- get_cost,
- get_omnimods,
- get_family,
- decoder
- )
-
--- Elm -------------------------------------------------------------------------
-import Dict
-
-import Json.Decode
-import Json.Decode.Pipeline
-
--- Map Editor ------------------------------------------------------------------
-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,
- family : FamilyID,
- depth : Int,
- omnimods : Struct.Omnimods.Type
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-get_id : Type -> Ref
-get_id tile = tile.id
-
-get_cost : Type -> Int
-get_cost tile = tile.crossing_cost
-
-get_name : Type -> String
-get_name tile = tile.name
-
-get_family : Type -> FamilyID
-get_family tile = tile.family
-
-get_omnimods : Type -> Struct.Omnimods.Type
-get_omnimods t = t.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 "ct" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "fa" Json.Decode.string)
- |> (Json.Decode.Pipeline.required "de" Json.Decode.int)
- |> (Json.Decode.Pipeline.required "omni" Struct.Omnimods.decoder)
- )
diff --git a/src/map-editor/src/Struct/TileInstance.elm b/src/map-editor/src/Struct/TileInstance.elm
deleted file mode 100644
index 635dbac..0000000
--- a/src/map-editor/src/Struct/TileInstance.elm
+++ /dev/null
@@ -1,245 +0,0 @@
-module 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,
- get_border_variant_id,
- get_border_class_id,
- get_local_variant_ix,
- error,
- solve,
- set_location_from_index,
- decoder,
- encode
- )
-
--- Elm -------------------------------------------------------------------------
-import Dict
-
-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
-
-
---------------------------------------------------------------------------------
--- TYPES -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-type alias Type =
- {
- location : Struct.Location.Type,
- crossing_cost : Int,
- family : Struct.Tile.FamilyID,
- class_id : Struct.Tile.Ref,
- variant_id : Struct.Tile.VariantID,
- triggers : (List String),
- borders : (List Border)
- }
-
-type alias Border =
- {
- class_id : Struct.Tile.Ref,
- variant_id : Struct.Tile.VariantID
- }
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-noise_function : Int -> Int -> Int -> Int
-noise_function a b c =
- (round (radians (toFloat ((a + 1) * 2 + (b + 1) * 3 + c))))
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-clone : Struct.Location.Type -> Type -> Type
-clone loc inst = {inst | location = loc}
-
-new_border : Struct.Tile.Ref -> Struct.Tile.VariantID -> Border
-new_border class_id variant_id =
- {
- class_id = class_id,
- variant_id = variant_id
- }
-
-default : 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 = []
- }
-
-error : Int -> Int -> Type
-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 inst = inst.class_id
-
-get_cost : Type -> Int
-get_cost inst = inst.crossing_cost
-
-get_location : Type -> Struct.Location.Type
-get_location inst = inst.location
-
-get_family : Type -> 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 tile_inst = tile_inst.variant_id
-
-get_border_variant_id : Border -> Struct.Tile.VariantID
-get_border_variant_id tile_border = tile_border.variant_id
-
-get_local_variant_ix : Type -> Int
-get_local_variant_ix tile_inst =
- (modBy
- Constants.UI.local_variants_per_tile
- (noise_function
- tile_inst.location.x
- tile_inst.location.y
- tile_inst.crossing_cost
- )
- )
-
-solve : (Dict.Dict Struct.Tile.Ref 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),
- family = (Struct.Tile.get_family tile)
- }
-
- Nothing ->
- {tile_inst |
- crossing_cost = -1,
- family = "-1"
- }
-
-
-list_to_borders : (
- (List String) ->
- (List Border) ->
- (List Border)
- )
-list_to_borders list borders =
- case list of
- (a :: (b :: c)) ->
- (list_to_borders
- c
- ({ class_id = a, variant_id = b } :: borders)
- )
- _ -> (List.reverse borders)
-
-decoder : (Json.Decode.Decoder Type)
-decoder =
- (Json.Decode.andThen
- (\tile_data ->
- case tile_data of
- (tile_id :: (variant_id :: borders)) ->
- (Json.Decode.succeed
- 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)
- |>
- (Json.Decode.Pipeline.required
- "t"
- (Json.Decode.list (Json.Decode.string))
- )
- |>
- (Json.Decode.Pipeline.hardcoded
- (list_to_borders borders [])
- )
- )
- _ -> (Json.Decode.succeed (error 0 0))
- )
- (Json.Decode.field "b" (Json.Decode.list (Json.Decode.string)))
- )
-
-get_border_class_id : Border -> Struct.Tile.Ref
-get_border_class_id tile_border = tile_border.class_id
-
-set_location_from_index : Int -> Int -> Type -> Type
-set_location_from_index map_width index tile_inst =
- {tile_inst |
- location =
- {
- x = (modBy map_width index),
- 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/map-editor/src/Struct/TilePattern.elm b/src/map-editor/src/Struct/TilePattern.elm
index d2d005c..c29e148 100644
--- a/src/map-editor/src/Struct/TilePattern.elm
+++ b/src/map-editor/src/Struct/TilePattern.elm
@@ -16,9 +16,9 @@ import List
import Json.Decode
import Json.Decode.Pipeline
--- Map Editor ------------------------------------------------------------------
-import Struct.Tile
-import Struct.TileInstance
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Tile
+import BattleMap.Struct.TileInstance
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -27,7 +27,7 @@ type alias Actual = String
type alias Type =
{
- v : Struct.Tile.VariantID,
+ v : BattleMap.Struct.Tile.VariantID,
w : Bool,
p : Actual
}
@@ -40,15 +40,15 @@ type alias Type =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_pattern_for : (
- Struct.Tile.FamilyID ->
- (List Struct.TileInstance.Type) ->
+ BattleMap.Struct.Tile.FamilyID ->
+ (List BattleMap.Struct.TileInstance.Type) ->
Actual
)
get_pattern_for source_fa neighborhood =
(List.foldl
(\t -> \acc ->
let
- t_fa = (Struct.TileInstance.get_family t)
+ t_fa = (BattleMap.Struct.TileInstance.get_family t)
in
if ((t_fa == "-1") || (t_fa == source_fa))
then (acc ++ "1")
@@ -72,7 +72,7 @@ patterns_match a b =
get_pattern : Type -> Actual
get_pattern tp = tp.p
-get_variant_id : Type -> Struct.Tile.VariantID
+get_variant_id : Type -> BattleMap.Struct.Tile.VariantID
get_variant_id tp = tp.v
is_wild : Type -> Bool
diff --git a/src/map-editor/src/Struct/Toolbox.elm b/src/map-editor/src/Struct/Toolbox.elm
index 5f08761..8a05fc2 100644
--- a/src/map-editor/src/Struct/Toolbox.elm
+++ b/src/map-editor/src/Struct/Toolbox.elm
@@ -19,25 +19,24 @@ module Struct.Toolbox exposing
default
)
--- Elm -------------------------------------------------------------------------
-
--- Map Editor ------------------------------------------------------------------
-import Struct.Location
-import Struct.Map
-import Struct.TileInstance
-
+-- Shared ----------------------------------------------------------------------
import Util.List
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Map
+import BattleMap.Struct.TileInstance
+
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
type alias Type =
{
- template : Struct.TileInstance.Type,
+ template : BattleMap.Struct.TileInstance.Type,
mode : Mode,
shape : Shape,
- selection : (List Struct.Location.Type),
- square_corner : (Maybe Struct.Location.Type)
+ selection : (List BattleMap.Struct.Location.Type),
+ square_corner : (Maybe BattleMap.Struct.Location.Type)
}
type Mode =
@@ -56,9 +55,9 @@ type Shape =
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
apply_mode_to : (
- Struct.Location.Type ->
- (Type, Struct.Map.Type) ->
- (Type, Struct.Map.Type)
+ BattleMap.Struct.Location.Type ->
+ (Type, BattleMap.Struct.Map.Type) ->
+ (Type, BattleMap.Struct.Map.Type)
)
apply_mode_to loc (tb, map) =
case tb.mode of
@@ -67,9 +66,9 @@ apply_mode_to loc (tb, map) =
then
(
tb,
- (Struct.Map.set_tile_to
+ (BattleMap.Struct.Map.set_tile_to
loc
- (Struct.TileInstance.clone loc tb.template)
+ (BattleMap.Struct.TileInstance.clone loc tb.template)
map
)
)
@@ -106,10 +105,10 @@ apply_mode_to loc (tb, map) =
)
get_filled_tiles_internals : (
- (Struct.Location.Type -> Bool) ->
- (List Struct.Location.Type) ->
- (List Struct.Location.Type) ->
- (List Struct.Location.Type)
+ (BattleMap.Struct.Location.Type -> Bool) ->
+ (List BattleMap.Struct.Location.Type) ->
+ (List BattleMap.Struct.Location.Type) ->
+ (List BattleMap.Struct.Location.Type)
)
get_filled_tiles_internals match_fun candidates result =
case (Util.List.pop candidates) of
@@ -129,7 +128,7 @@ get_filled_tiles_internals match_fun candidates result =
)
)
)
- (Struct.Location.neighbors loc)
+ (BattleMap.Struct.Location.neighbors loc)
)
++ remaining_candidates
)
@@ -139,24 +138,25 @@ get_filled_tiles_internals match_fun candidates result =
(get_filled_tiles_internals match_fun remaining_candidates result)
get_filled_tiles : (
- (List Struct.Location.Type) ->
- Struct.Map.Type ->
- Struct.Location.Type ->
- (List Struct.Location.Type)
+ (List BattleMap.Struct.Location.Type) ->
+ BattleMap.Struct.Map.Type ->
+ BattleMap.Struct.Location.Type ->
+ (List BattleMap.Struct.Location.Type)
)
get_filled_tiles selection map loc =
- case (Struct.Map.try_getting_tile_at loc map) of
+ case (BattleMap.Struct.Map.try_getting_tile_at loc map) of
Nothing -> []
(Just target) ->
let
- target_class_id = (Struct.TileInstance.get_class_id target)
+ target_class_id =
+ (BattleMap.Struct.TileInstance.get_class_id target)
map_match_fun =
(\e ->
- (case (Struct.Map.try_getting_tile_at e map) of
+ (case (BattleMap.Struct.Map.try_getting_tile_at e map) of
Nothing -> False
(Just t) ->
(
- (Struct.TileInstance.get_class_id t)
+ (BattleMap.Struct.TileInstance.get_class_id t)
== target_class_id
)
)
@@ -173,10 +173,10 @@ get_filled_tiles selection map loc =
)
get_square_tiles : (
- Struct.Location.Type ->
- Struct.Map.Type ->
- Struct.Location.Type ->
- (List Struct.Location.Type)
+ BattleMap.Struct.Location.Type ->
+ BattleMap.Struct.Map.Type ->
+ BattleMap.Struct.Location.Type ->
+ (List BattleMap.Struct.Location.Type)
)
get_square_tiles corner map new_loc =
let
@@ -189,7 +189,7 @@ get_square_tiles corner map new_loc =
then (List.range corner.y new_loc.y)
else (List.range new_loc.y corner.y)
in
- (Util.List.product_map (Struct.Location.new) x_range y_range)
+ (Util.List.product_map (BattleMap.Struct.Location.new) x_range y_range)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -197,14 +197,14 @@ get_square_tiles corner map new_loc =
default : Type
default =
{
- template = (Struct.TileInstance.error 0 0),
+ template = (BattleMap.Struct.TileInstance.error 0 0),
mode = Draw,
shape = Simple,
selection = [],
square_corner = Nothing
}
-get_template : Type -> Struct.TileInstance.Type
+get_template : Type -> BattleMap.Struct.TileInstance.Type
get_template tb = tb.template
get_mode : Type -> Mode
@@ -235,10 +235,10 @@ get_shapes mode =
Square
]
-get_selection : Type -> (List Struct.Location.Type)
+get_selection : Type -> (List BattleMap.Struct.Location.Type)
get_selection tb = tb.selection
-set_template : Struct.TileInstance.Type -> Type -> Type
+set_template : BattleMap.Struct.TileInstance.Type -> Type -> Type
set_template template tb =
{tb |
template = template,
@@ -272,19 +272,19 @@ clear_selection tb =
square_corner = Nothing
}
-is_selected : Struct.Location.Type -> Type -> Bool
+is_selected : BattleMap.Struct.Location.Type -> Type -> Bool
is_selected loc tb =
(List.member loc tb.selection)
-is_square_corner : Struct.Location.Type -> Type -> Bool
+is_square_corner : BattleMap.Struct.Location.Type -> Type -> Bool
is_square_corner loc tb =
(tb.square_corner == (Just loc))
apply_to : (
- Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
Type ->
- Struct.Map.Type ->
- (Type, Struct.Map.Type)
+ BattleMap.Struct.Map.Type ->
+ (Type, BattleMap.Struct.Map.Type)
)
apply_to loc tb map =
case tb.shape of
diff --git a/src/map-editor/src/Struct/UI.elm b/src/map-editor/src/Struct/UI.elm
index 7af92a6..a027b26 100644
--- a/src/map-editor/src/Struct/UI.elm
+++ b/src/map-editor/src/Struct/UI.elm
@@ -19,8 +19,8 @@ module Struct.UI exposing
set_previous_action
)
--- Map Editor ------------------------------------------------------------------
-import Struct.Location
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -29,9 +29,10 @@ type Tab =
StatusTab
| TilesTab
| SettingsTab
+ | MarkersTab
type Action =
- SelectedLocation Struct.Location.Ref
+ SelectedLocation BattleMap.Struct.Location.Ref
type alias Type =
{
@@ -80,11 +81,12 @@ to_string tab =
case tab of
StatusTab -> "Status"
TilesTab -> "Tiles"
+ MarkersTab -> "Markers"
SettingsTab -> "Settings"
get_all_tabs : (List Tab)
get_all_tabs =
- [StatusTab, TilesTab, SettingsTab]
+ [StatusTab, TilesTab, MarkersTab, SettingsTab]
-- Previous Action -------------------------------------------------------------
set_previous_action : (Maybe Action) -> Type -> Type
diff --git a/src/map-editor/src/Update/ChangeScale.elm b/src/map-editor/src/Update/ChangeScale.elm
index a2e10ce..164da34 100644
--- a/src/map-editor/src/Update/ChangeScale.elm
+++ b/src/map-editor/src/Update/ChangeScale.elm
@@ -1,7 +1,6 @@
module Update.ChangeScale exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Local Module -------------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.UI
diff --git a/src/map-editor/src/Update/ClearToolboxSelection.elm b/src/map-editor/src/Update/ClearToolboxSelection.elm
index 7f10b48..011b91f 100644
--- a/src/map-editor/src/Update/ClearToolboxSelection.elm
+++ b/src/map-editor/src/Update/ClearToolboxSelection.elm
@@ -1,7 +1,6 @@
module Update.ClearToolboxSelection exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Toolbox
import Struct.Model
diff --git a/src/map-editor/src/Update/GoToMainMenu.elm b/src/map-editor/src/Update/GoToMainMenu.elm
index f2ec989..c22e18e 100644
--- a/src/map-editor/src/Update/GoToMainMenu.elm
+++ b/src/map-editor/src/Update/GoToMainMenu.elm
@@ -1,9 +1,9 @@
module Update.GoToMainMenu exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battle ----------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
import Action.Ports
+-- Battle ----------------------------------------------------------------------
import Constants.IO
import Struct.Model
diff --git a/src/map-editor/src/Update/HandleServerReply.elm b/src/map-editor/src/Update/HandleServerReply.elm
index e984807..80ca116 100644
--- a/src/map-editor/src/Update/HandleServerReply.elm
+++ b/src/map-editor/src/Update/HandleServerReply.elm
@@ -12,15 +12,17 @@ import Struct.Flags
import Util.Http
--- Map Editor ------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+
+-- Local Module ----------------------------------------------------------------
import Constants.IO
-import Struct.Map
import Struct.Error
import Struct.Event
import Struct.Model
import Struct.ServerReply
-import Struct.Tile
import Struct.TilePattern
--------------------------------------------------------------------------------
@@ -56,7 +58,7 @@ disconnected current_state =
)
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)))
)
@@ -74,13 +76,13 @@ add_tile_pattern tp current_state =
((Struct.Model.add_tile_pattern tp model), cmds)
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)))
)
set_map map current_state =
let (model, cmds) = current_state in
- ({model | map = (Struct.Map.solve_tiles model.tiles map)}, cmds)
+ ({model | map = (BattleMap.Struct.Map.solve_tiles model.tiles map)}, cmds)
refresh_map : (
(Struct.Model.Type, (List (Cmd Struct.Event.Type))) ->
@@ -88,7 +90,12 @@ refresh_map : (
)
refresh_map current_state =
let (model, cmds) = current_state in
- ({model | map = (Struct.Map.solve_tiles model.tiles model.map)}, cmds)
+ (
+ {model |
+ map = (BattleMap.Struct.Map.solve_tiles model.tiles model.map)
+ },
+ cmds
+ )
apply_command : (
Struct.ServerReply.Type ->
diff --git a/src/map-editor/src/Update/PrettifySelectedTiles.elm b/src/map-editor/src/Update/PrettifySelectedTiles.elm
index f409da8..a55eb67 100644
--- a/src/map-editor/src/Update/PrettifySelectedTiles.elm
+++ b/src/map-editor/src/Update/PrettifySelectedTiles.elm
@@ -5,55 +5,58 @@ import Dict
import Set
--- Battlemap -------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.List
+
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+import BattleMap.Struct.TileInstance
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
-import Struct.Location
-import Struct.Map
import Struct.Model
-import Struct.Tile
-import Struct.TileInstance
import Struct.TilePattern
import Struct.Toolbox
-import Util.List
-
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
neighborhood_tile_instances : (
- Struct.Location.Type ->
- Struct.Map.Type ->
- (List Struct.TileInstance.Type)
+ BattleMap.Struct.Location.Type ->
+ BattleMap.Struct.Map.Type ->
+ (List BattleMap.Struct.TileInstance.Type)
)
neighborhood_tile_instances loc map =
(List.map
(\e ->
- case (Struct.Map.try_getting_tile_at e map) of
- Nothing -> (Struct.TileInstance.error -1 -1)
+ case (BattleMap.Struct.Map.try_getting_tile_at e map) of
+ Nothing -> (BattleMap.Struct.TileInstance.error -1 -1)
(Just t) -> t
)
- (Struct.Location.get_full_neighborhood loc)
+ (BattleMap.Struct.Location.get_full_neighborhood loc)
)
get_nigh_patterns : (
- Struct.Tile.FamilyID ->
- (List Struct.TileInstance.Type) ->
- (List (Struct.Tile.FamilyID, Struct.Tile.Ref))
+ BattleMap.Struct.Tile.FamilyID ->
+ (List BattleMap.Struct.TileInstance.Type) ->
+ (List (BattleMap.Struct.Tile.FamilyID, BattleMap.Struct.Tile.Ref))
)
get_nigh_patterns source_fm full_neighborhood =
(Set.toList
(List.foldl
(\e -> \acc ->
let
- e_fm = (Struct.TileInstance.get_family e)
+ e_fm = (BattleMap.Struct.TileInstance.get_family e)
in
if (e_fm <= source_fm)
then acc
else
(Set.insert
(
- (Struct.TileInstance.get_family e),
- (Struct.TileInstance.get_class_id e)
+ (BattleMap.Struct.TileInstance.get_family e),
+ (BattleMap.Struct.TileInstance.get_class_id e)
)
acc
)
@@ -65,9 +68,9 @@ get_nigh_patterns source_fm full_neighborhood =
nigh_pattern_to_border : (
Struct.Model.Type ->
- (List Struct.TileInstance.Type) ->
- (Struct.Tile.FamilyID, Struct.Tile.Ref) ->
- (Struct.TileInstance.Border)
+ (List BattleMap.Struct.TileInstance.Type) ->
+ (BattleMap.Struct.Tile.FamilyID, BattleMap.Struct.Tile.Ref) ->
+ (BattleMap.Struct.TileInstance.Border)
)
nigh_pattern_to_border model full_neighborhood nigh_pattern =
let
@@ -87,35 +90,35 @@ nigh_pattern_to_border model full_neighborhood nigh_pattern =
model.wild_tile_patterns
)
of
- Nothing -> (Struct.TileInstance.new_border "0" "0")
+ Nothing -> (BattleMap.Struct.TileInstance.new_border "0" "0")
(Just tp) ->
- (Struct.TileInstance.new_border
+ (BattleMap.Struct.TileInstance.new_border
tid
(Struct.TilePattern.get_variant_id tp)
)
- (Just v) -> (Struct.TileInstance.new_border tid v)
+ (Just v) -> (BattleMap.Struct.TileInstance.new_border tid v)
apply_to_location : (
Struct.Model.Type ->
- Struct.Location.Type ->
- Struct.Map.Type ->
- Struct.Map.Type
+ BattleMap.Struct.Location.Type ->
+ BattleMap.Struct.Map.Type ->
+ BattleMap.Struct.Map.Type
)
apply_to_location model loc map =
- case (Struct.Map.try_getting_tile_at loc map) of
+ case (BattleMap.Struct.Map.try_getting_tile_at loc map) of
Nothing -> map
(Just base) ->
let
full_neighborhood = (neighborhood_tile_instances loc map)
in
- (Struct.Map.set_tile_to
+ (BattleMap.Struct.Map.set_tile_to
loc
- (Struct.TileInstance.set_borders
+ (BattleMap.Struct.TileInstance.set_borders
(List.map
(nigh_pattern_to_border model full_neighborhood)
(get_nigh_patterns
- (Struct.TileInstance.get_family base)
+ (BattleMap.Struct.TileInstance.get_family base)
full_neighborhood
)
)
diff --git a/src/map-editor/src/Update/SelectTab.elm b/src/map-editor/src/Update/SelectTab.elm
index c25ec56..2a41303 100644
--- a/src/map-editor/src/Update/SelectTab.elm
+++ b/src/map-editor/src/Update/SelectTab.elm
@@ -1,7 +1,6 @@
module Update.SelectTab exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Model
import Struct.Event
import Struct.UI
diff --git a/src/map-editor/src/Update/SelectTile.elm b/src/map-editor/src/Update/SelectTile.elm
index e7eeeb6..dcb12d7 100644
--- a/src/map-editor/src/Update/SelectTile.elm
+++ b/src/map-editor/src/Update/SelectTile.elm
@@ -1,11 +1,11 @@
module Update.SelectTile exposing (apply_to)
--- Elm -------------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Location
--- Map Editor ------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.UI
-import Struct.Location
import Struct.Model
import Struct.Toolbox
@@ -18,7 +18,7 @@ import Struct.Toolbox
--------------------------------------------------------------------------------
apply_to : (
Struct.Model.Type ->
- Struct.Location.Ref ->
+ BattleMap.Struct.Location.Ref ->
(Struct.Model.Type, (Cmd Struct.Event.Type))
)
apply_to model loc_ref =
@@ -41,7 +41,7 @@ apply_to model loc_ref =
let
(toolbox, map) =
(Struct.Toolbox.apply_to
- (Struct.Location.from_ref loc_ref)
+ (BattleMap.Struct.Location.from_ref loc_ref)
model.toolbox
model.map
)
diff --git a/src/map-editor/src/Update/SendMapUpdate.elm b/src/map-editor/src/Update/SendMapUpdate.elm
index 0fd5039..ad8433e 100644
--- a/src/map-editor/src/Update/SendMapUpdate.elm
+++ b/src/map-editor/src/Update/SendMapUpdate.elm
@@ -1,7 +1,7 @@
module Update.SendMapUpdate exposing (apply_to)
-- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Comm.SendMapUpdate
import Struct.Event
diff --git a/src/map-editor/src/Update/SetRequestedHelp.elm b/src/map-editor/src/Update/SetRequestedHelp.elm
index 8f76e3b..45e5e93 100644
--- a/src/map-editor/src/Update/SetRequestedHelp.elm
+++ b/src/map-editor/src/Update/SetRequestedHelp.elm
@@ -1,7 +1,6 @@
module Update.SetRequestedHelp exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.HelpRequest
import Struct.Model
diff --git a/src/map-editor/src/Update/SetToolboxMode.elm b/src/map-editor/src/Update/SetToolboxMode.elm
index 6104558..ef38a27 100644
--- a/src/map-editor/src/Update/SetToolboxMode.elm
+++ b/src/map-editor/src/Update/SetToolboxMode.elm
@@ -1,7 +1,6 @@
module Update.SetToolboxMode exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Map Editor ------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.Toolbox
diff --git a/src/map-editor/src/Update/SetToolboxShape.elm b/src/map-editor/src/Update/SetToolboxShape.elm
index c0bd273..073a66f 100644
--- a/src/map-editor/src/Update/SetToolboxShape.elm
+++ b/src/map-editor/src/Update/SetToolboxShape.elm
@@ -1,7 +1,6 @@
module Update.SetToolboxShape exposing (apply_to)
--- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Local module ----------------------------------------------------------------
import Struct.Event
import Struct.Toolbox
import Struct.Model
diff --git a/src/map-editor/src/Update/SetToolboxTemplate.elm b/src/map-editor/src/Update/SetToolboxTemplate.elm
index 439a8e7..621a8fe 100644
--- a/src/map-editor/src/Update/SetToolboxTemplate.elm
+++ b/src/map-editor/src/Update/SetToolboxTemplate.elm
@@ -3,10 +3,12 @@ module Update.SetToolboxTemplate exposing (apply_to)
-- Elm -------------------------------------------------------------------------
import Dict
--- Map Editor ------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.TileInstance
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Toolbox
-import Struct.TileInstance
import Struct.Model
--------------------------------------------------------------------------------
@@ -29,8 +31,8 @@ apply_to model main_class_id variant_id =
(Struct.Toolbox.set_template
(
case (Dict.get main_class_id model.tiles) of
- (Just tile) -> (Struct.TileInstance.default tile)
- _ -> (Struct.TileInstance.error 0 0)
+ (Just tile) -> (BattleMap.Struct.TileInstance.default tile)
+ _ -> (BattleMap.Struct.TileInstance.error 0 0)
)
model.toolbox
)
diff --git a/src/map-editor/src/View/MainMenu.elm b/src/map-editor/src/View/MainMenu.elm
index 317250d..8a69aec 100644
--- a/src/map-editor/src/View/MainMenu.elm
+++ b/src/map-editor/src/View/MainMenu.elm
@@ -5,7 +5,7 @@ import Html
import Html.Attributes
import Html.Events
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.UI
diff --git a/src/map-editor/src/View/Map.elm b/src/map-editor/src/View/Map.elm
index a022850..0104669 100644
--- a/src/map-editor/src/View/Map.elm
+++ b/src/map-editor/src/View/Map.elm
@@ -9,23 +9,25 @@ import Html.Lazy
import List
--- Map Editor ------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+
+-- Local Module ----------------------------------------------------------------
import Constants.UI
import Struct.Event
-import Struct.Map
import Struct.Model
import Struct.Toolbox
import Struct.UI
-import View.Map.Tile
+import View.SelectableTile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_tiles_html : (
Struct.Toolbox.Type ->
- Struct.Map.Type ->
+ BattleMap.Struct.Map.Type ->
(Html.Html Struct.Event.Type)
)
get_tiles_html tb map =
@@ -37,7 +39,7 @@ get_tiles_html tb map =
(
(String.fromInt
(
- (Struct.Map.get_width map)
+ (BattleMap.Struct.Map.get_width map)
* Constants.UI.tile_size
)
)
@@ -49,7 +51,7 @@ get_tiles_html tb map =
(
(String.fromInt
(
- (Struct.Map.get_height map)
+ (BattleMap.Struct.Map.get_height map)
* Constants.UI.tile_size
)
)
@@ -58,8 +60,8 @@ get_tiles_html tb map =
)
]
(List.map
- (View.Map.Tile.get_html tb)
- (Array.toList (Struct.Map.get_tiles map))
+ (View.SelectableTile.get_html False tb)
+ (Array.toList (BattleMap.Struct.Map.get_tiles map))
)
)
diff --git a/src/map-editor/src/View/Map/Tile.elm b/src/map-editor/src/View/Map/Tile.elm
deleted file mode 100644
index 8fe96cf..0000000
--- a/src/map-editor/src/View/Map/Tile.elm
+++ /dev/null
@@ -1,54 +0,0 @@
-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.Toolbox
-
---------------------------------------------------------------------------------
--- LOCAL -----------------------------------------------------------------------
---------------------------------------------------------------------------------
-
---------------------------------------------------------------------------------
--- EXPORTED --------------------------------------------------------------------
---------------------------------------------------------------------------------
-
-get_html : (
- Bool ->
- Struct.Toolbox.Type ->
- Struct.TileInstance.Type ->
- (Html.Html Struct.Event.Type)
- )
-get_html display_cost tb tile =
- let
- tile_loc = (Struct.TileInstance.get_location tile)
- in
- (View.Map.Tile.get_html_with_extra
- display_cost
- [
- (
- if (Struct.Toolbox.is_selected tile_loc tb)
- then (Html.Attributes.class "tile-selected")
- else (Html.Attributes.class "")
- ),
- (
- if (Struct.Toolbox.is_square_corner tile_loc tb)
- then (Html.Attributes.class "tile-square-corner")
- else (Html.Attributes.class "")
- )
- ]
- tile
- )
diff --git a/src/map-editor/src/View/MessageBoard.elm b/src/map-editor/src/View/MessageBoard.elm
index f1a2e9b..00859e7 100644
--- a/src/map-editor/src/View/MessageBoard.elm
+++ b/src/map-editor/src/View/MessageBoard.elm
@@ -3,7 +3,7 @@ module View.MessageBoard exposing (get_html)
-- Elm -------------------------------------------------------------------------
import Html
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
diff --git a/src/map-editor/src/View/MessageBoard/Error.elm b/src/map-editor/src/View/MessageBoard/Error.elm
index 947586e..72de518 100644
--- a/src/map-editor/src/View/MessageBoard/Error.elm
+++ b/src/map-editor/src/View/MessageBoard/Error.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Error exposing (get_html)
import Html
import Html.Attributes
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Error
import Struct.Event
import Struct.Model
diff --git a/src/map-editor/src/View/MessageBoard/Help.elm b/src/map-editor/src/View/MessageBoard/Help.elm
index 3bc8f3c..eea0c8a 100644
--- a/src/map-editor/src/View/MessageBoard/Help.elm
+++ b/src/map-editor/src/View/MessageBoard/Help.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Help exposing (get_html)
import Html
import Html.Attributes
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.HelpRequest
import Struct.Model
diff --git a/src/map-editor/src/View/MessageBoard/Help/Guide.elm b/src/map-editor/src/View/MessageBoard/Help/Guide.elm
index 36d1e50..e4aff37 100644
--- a/src/map-editor/src/View/MessageBoard/Help/Guide.elm
+++ b/src/map-editor/src/View/MessageBoard/Help/Guide.elm
@@ -4,7 +4,7 @@ module View.MessageBoard.Help.Guide exposing (get_html_contents)
import Html
import Html.Attributes
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm
index 6e62ac5..7547e17 100644
--- a/src/map-editor/src/View/SubMenu.elm
+++ b/src/map-editor/src/View/SubMenu.elm
@@ -4,13 +4,14 @@ module View.SubMenu exposing (get_html)
import Html
import Html.Attributes
--- Map Editor ------------------------------------------------------------------
+-- Shared ----------------------------------------------------------------------
+import Util.Html
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
import Struct.UI
-import Util.Html
-
import View.SubMenu.Markers
import View.SubMenu.Settings
import View.SubMenu.TileStatus
diff --git a/src/map-editor/src/View/SubMenu/Markers.elm b/src/map-editor/src/View/SubMenu/Markers.elm
index f975eef..62aa89f 100644
--- a/src/map-editor/src/View/SubMenu/Markers.elm
+++ b/src/map-editor/src/View/SubMenu/Markers.elm
@@ -7,33 +7,30 @@ import Html
import Html.Attributes
import Html.Events
--- Map Editor ------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Tile
+import BattleMap.Struct.Map
+import BattleMap.Struct.Marker
+import BattleMap.Struct.TileInstance
+
+import BattleMap.View.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
-import Struct.Tile
-import Struct.TileInstance
-
-import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_marker_html : (
- (String, Struct.MapMarker.Type)
+ (String, BattleMap.Struct.Marker.Type)
-> (Html.Html Struct.Event.Type)
)
get_marker_html (ref, marker) =
(Html.div
[
- (Html.Attributes.class "tile"),
- (Html.Attributes.class "tiled"),
- (Html.Attributes.class "clickable"),
- (Html.Attributes.class "tile-variant-0"),
- (Html.Events.onClick
- (Struct.Event.TemplateRequested ((Struct.Tile.get_id tile), "0"))
- )
]
- (View.Map.Tile.get_content_html (Struct.TileInstance.default tile))
+ [(Html.text ref)]
)
--------------------------------------------------------------------------------
@@ -48,6 +45,6 @@ get_html model =
]
(List.map
(get_marker_html)
- (Dict.toList (Struct.Map.get_markers model.map))
+ (Dict.toList (BattleMap.Struct.Map.get_markers model.map))
)
)
diff --git a/src/map-editor/src/View/SubMenu/Settings.elm b/src/map-editor/src/View/SubMenu/Settings.elm
index bd0561c..e14de91 100644
--- a/src/map-editor/src/View/SubMenu/Settings.elm
+++ b/src/map-editor/src/View/SubMenu/Settings.elm
@@ -5,7 +5,7 @@ import Html
import Html.Attributes
import Html.Events
--- Battlemap -------------------------------------------------------------------
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
diff --git a/src/map-editor/src/View/SubMenu/TileStatus.elm b/src/map-editor/src/View/SubMenu/TileStatus.elm
index 0fd5031..c1091ad 100644
--- a/src/map-editor/src/View/SubMenu/TileStatus.elm
+++ b/src/map-editor/src/View/SubMenu/TileStatus.elm
@@ -6,26 +6,31 @@ import Dict
import Html
import Html.Attributes
--- Map Editor ------------------------------------------------------------------
+-- 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.Tile
+
+-- Local Module ----------------------------------------------------------------
import Constants.Movement
import Struct.Event
-import Struct.Location
-import Struct.Map
import Struct.Model
-import Struct.Omnimods
-import Struct.Tile
-import Struct.TileInstance
import Struct.UI
-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
[
@@ -36,21 +41,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.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
@@ -60,14 +70,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
@@ -85,10 +95,13 @@ 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
[
@@ -133,7 +146,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
[
@@ -141,23 +154,31 @@ 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)
+ )
]
)
get_tile_info_html : (
Struct.Model.Type ->
- Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
(Html.Html Struct.Event.Type)
)
get_tile_info_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
[
@@ -198,7 +219,7 @@ get_html model =
(Just (Struct.UI.SelectedLocation loc)) ->
(get_tile_info_html
model
- (Struct.Location.from_ref loc)
+ (BattleMap.Struct.Location.from_ref loc)
)
_ ->
diff --git a/src/map-editor/src/View/SubMenu/Tiles.elm b/src/map-editor/src/View/SubMenu/Tiles.elm
index 511980d..16b147e 100644
--- a/src/map-editor/src/View/SubMenu/Tiles.elm
+++ b/src/map-editor/src/View/SubMenu/Tiles.elm
@@ -7,19 +7,21 @@ import Html
import Html.Attributes
import Html.Events
--- Map Editor ------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Tile
+import BattleMap.Struct.TileInstance
+
+import BattleMap.View.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
import Struct.Model
-import Struct.Tile
-import Struct.TileInstance
-
-import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_icon_html : (
- (Struct.Tile.Ref, Struct.Tile.Type) ->
+ (BattleMap.Struct.Tile.Ref, BattleMap.Struct.Tile.Type) ->
(Html.Html Struct.Event.Type)
)
get_icon_html (ref, tile) =
@@ -30,10 +32,14 @@ get_icon_html (ref, tile) =
(Html.Attributes.class "clickable"),
(Html.Attributes.class "tile-variant-0"),
(Html.Events.onClick
- (Struct.Event.TemplateRequested ((Struct.Tile.get_id tile), "0"))
+ (Struct.Event.TemplateRequested
+ ((BattleMap.Struct.Tile.get_id tile), "0")
+ )
)
]
- (View.Map.Tile.get_content_html (Struct.TileInstance.default tile))
+ (BattleMap.View.Tile.get_content_html
+ (BattleMap.Struct.TileInstance.default tile)
+ )
)
--------------------------------------------------------------------------------
diff --git a/src/map-editor/src/View/Toolbox.elm b/src/map-editor/src/View/Toolbox.elm
index 442d01b..c9711d4 100644
--- a/src/map-editor/src/View/Toolbox.elm
+++ b/src/map-editor/src/View/Toolbox.elm
@@ -7,21 +7,24 @@ import Html
import Html.Attributes
import Html.Events
--- Map Editor ------------------------------------------------------------------
+-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.Map
+import BattleMap.Struct.Tile
+import BattleMap.Struct.TileInstance
+
+import BattleMap.View.Tile
+
+-- Local Module ----------------------------------------------------------------
import Struct.Event
-import Struct.Map
import Struct.Model
-import Struct.Tile
-import Struct.TileInstance
import Struct.Toolbox
-import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
get_template_icon_html : (
- Struct.TileInstance.Type ->
+ BattleMap.Struct.TileInstance.Type ->
(Html.Html Struct.Event.Type)
)
get_template_icon_html template =
@@ -32,7 +35,7 @@ get_template_icon_html template =
(Html.Attributes.class "tile"),
(Html.Attributes.class "tile-variant-0")
]
- (View.Map.Tile.get_content_html template)
+ (BattleMap.View.Tile.get_content_html template)
)
get_mode_button : (
@@ -139,7 +142,7 @@ get_html model =
(get_template_icon_html (Struct.Toolbox.get_template tb)),
(get_modes_menu_html tb),
(get_shapes_menu_html tb),
- (get_markers_html (Dict.keys (Struct.Map.get_markers model.map))),
+ (get_markers_html (Dict.keys (BattleMap.Struct.Map.get_markers model.map))),
(get_others_menu_html)
]
)
diff --git a/src/shared/battle-map/BattleMap/Struct/Location.elm b/src/shared/battle-map/BattleMap/Struct/Location.elm
index 3443150..da3b8ef 100644
--- a/src/shared/battle-map/BattleMap/Struct/Location.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Location.elm
@@ -27,6 +27,13 @@ type alias Ref = (Int, Int)
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
+new : Int -> Int -> Type
+new x y =
+ {
+ x = x,
+ y = y
+ }
+
neighbor : BattleMap.Struct.Direction.Type -> Type -> Type
neighbor dir loc =
case dir of
@@ -68,3 +75,27 @@ encode loc =
( "y", (Json.Encode.int loc.y) )
]
)
+
+neighbors : Type -> (List Type)
+neighbors loc =
+ [
+ {loc | x = (loc.x + 1)},
+ {loc | x = (loc.x - 1)},
+ {loc | y = (loc.y - 1)},
+ {loc | y = (loc.y + 1)}
+ ]
+
+get_full_neighborhood : Type -> (List Type)
+get_full_neighborhood loc =
+ [
+ {loc | x = (loc.x - 1), y = (loc.y - 1)},
+ {loc | y = (loc.y - 1)},
+ {loc | x = (loc.x + 1), y = (loc.y - 1)},
+ {loc | x = (loc.x - 1)},
+ {loc | x = (loc.x + 1)},
+ {loc | x = (loc.x - 1), y = (loc.y + 1)},
+ {loc | y = (loc.y + 1)},
+ {loc | x = (loc.x + 1), y = (loc.y + 1)}
+ ]
+
+