summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/battle-characters/BattleCharacters/View/Portrait.elm2
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Map.elm27
-rw-r--r--src/shared/battle-map/BattleMap/View/TileInfo.elm3
-rw-r--r--src/shared/elm/Shared/Struct/Flags.elm4
-rw-r--r--src/shared/elm/Shared/Update/Sequence.elm6
5 files changed, 30 insertions, 12 deletions
diff --git a/src/shared/battle-characters/BattleCharacters/View/Portrait.elm b/src/shared/battle-characters/BattleCharacters/View/Portrait.elm
index 37b6d1f..05497a9 100644
--- a/src/shared/battle-characters/BattleCharacters/View/Portrait.elm
+++ b/src/shared/battle-characters/BattleCharacters/View/Portrait.elm
@@ -9,7 +9,7 @@ import Html.Attributes
import Html.Events
-- Shared ----------------------------------------------------------------------
-import Util.Html
+import Shared.Util.Html
-- Battle Characters -----------------------------------------------------------
import BattleCharacters.Struct.Armor
diff --git a/src/shared/battle-map/BattleMap/Struct/Map.elm b/src/shared/battle-map/BattleMap/Struct/Map.elm
index cbab5b2..3504f95 100644
--- a/src/shared/battle-map/BattleMap/Struct/Map.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Map.elm
@@ -9,6 +9,7 @@ module BattleMap.Struct.Map exposing
remove_marker,
add_marker,
get_tile_data_function,
+ get_tile_cost_function,
get_omnimods_at,
get_tiles,
get_width,
@@ -28,7 +29,7 @@ import Dict
import Json.Decode
-- Shared ----------------------------------------------------------------------
-import Util.Array
+import Shared.Util.Array
-- Battle ----------------------------------------------------------------------
import Battle.Struct.Omnimods
@@ -98,7 +99,7 @@ remove_marker marker_name map =
content =
(Set.foldl
(\loc array ->
- (Util.Array.update_unsafe
+ (Shared.Util.Array.update_unsafe
(location_to_index
(BattleMap.Struct.Location.from_ref loc)
map
@@ -121,7 +122,7 @@ add_marker marker_name marker map =
content =
(Set.foldl
(\loc array ->
- (Util.Array.update_unsafe
+ (Shared.Util.Array.update_unsafe
(location_to_index
(BattleMap.Struct.Location.from_ref loc)
map
@@ -263,3 +264,23 @@ get_tile_data_function bmap occupied_tiles start_loc loc =
Nothing -> (Constants.Movement.cost_when_out_of_bounds, 0)
else
(Constants.Movement.cost_when_out_of_bounds, 0)
+
+get_tile_cost_function : (
+ Type ->
+ (List BattleMap.Struct.Location.Type) ->
+ BattleMap.Struct.Location.Type ->
+ BattleMap.Struct.Location.Type ->
+ Int
+ )
+get_tile_cost_function bmap occupied_tiles start_loc loc =
+ if (has_location loc bmap)
+ then
+ case (Array.get (location_to_index loc bmap) bmap.content) of
+ (Just tile) ->
+ if ((loc /= start_loc) && (List.member loc occupied_tiles))
+ then Constants.Movement.cost_when_occupied_tile
+ else (BattleMap.Struct.TileInstance.get_cost tile)
+
+ Nothing -> (Constants.Movement.cost_when_out_of_bounds)
+ else
+ (Constants.Movement.cost_when_out_of_bounds)
diff --git a/src/shared/battle-map/BattleMap/View/TileInfo.elm b/src/shared/battle-map/BattleMap/View/TileInfo.elm
index 8769157..8dc4788 100644
--- a/src/shared/battle-map/BattleMap/View/TileInfo.elm
+++ b/src/shared/battle-map/BattleMap/View/TileInfo.elm
@@ -6,9 +6,6 @@ import Dict
import Html
import Html.Attributes
--- Shared ----------------------------------------------------------------------
-import Util.Html
-
-- Battle ----------------------------------------------------------------------
import Battle.Struct.Omnimods
diff --git a/src/shared/elm/Shared/Struct/Flags.elm b/src/shared/elm/Shared/Struct/Flags.elm
index f57362e..ff4dd20 100644
--- a/src/shared/elm/Shared/Struct/Flags.elm
+++ b/src/shared/elm/Shared/Struct/Flags.elm
@@ -12,7 +12,7 @@ module Shared.Struct.Flags exposing
import List
-- Shared ----------------------------------------------------------------------
-import Util.List
+import Shared.Util.List
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -39,7 +39,7 @@ parameter_as_url parameter =
maybe_get_parameter : String -> Type -> (Maybe String)
maybe_get_parameter parameter flags =
case
- (Util.List.get_first
+ (Shared.Util.List.get_first
(\e -> ((List.head e) == (Just parameter)))
flags.url_parameters
)
diff --git a/src/shared/elm/Shared/Update/Sequence.elm b/src/shared/elm/Shared/Update/Sequence.elm
index ff33ae4..8f5b3e9 100644
--- a/src/shared/elm/Shared/Update/Sequence.elm
+++ b/src/shared/elm/Shared/Update/Sequence.elm
@@ -4,6 +4,7 @@ module Shared.Update.Sequence exposing (sequence)
import List
-- Local Module ----------------------------------------------------------------
+import Struct.Event
import Struct.Model
--------------------------------------------------------------------------------
@@ -16,9 +17,7 @@ sequence_step : (
)
sequence_step action (model, cmd_list) =
let (next_model, new_cmd) = (action model) in
- case new_cmd of
- Cmd.none -> (next_model, cmd_list)
- _ -> (next_model, (cmd_list ++ new_cmds))
+ (next_model, (new_cmd :: cmd_list))
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
@@ -27,6 +26,7 @@ sequence : (
(List
(Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type)))
)
+ -> Struct.Model.Type
-> (Struct.Model.Type, (Cmd Struct.Event.Type))
)
sequence actions model =