summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-06-13 13:32:43 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2019-06-13 13:32:43 +0200
commit499c0981df958643097f96365138df689432e5b4 (patch)
tree4ad005b50aa261612e6a46f4549c1046134d3644 /src/shared/battle-map/BattleMap/Struct/Map.elm
parent9eaf4c0a006e2a08fdd1e2248978c4ac5cdaef3b (diff)
Adds AoO pathfinding & temporary representation.
The animation manager does not work correctly though: when a move action has been interrupted, it will rewind like if there was only the last movement part, yet play back all parts, landing the character at the wrong location.
Diffstat (limited to 'src/shared/battle-map/BattleMap/Struct/Map.elm')
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Map.elm24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/shared/battle-map/BattleMap/Struct/Map.elm b/src/shared/battle-map/BattleMap/Struct/Map.elm
index 8be6300..d2c950f 100644
--- a/src/shared/battle-map/BattleMap/Struct/Map.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Map.elm
@@ -6,6 +6,8 @@ module BattleMap.Struct.Map exposing
get_height,
get_markers,
set_markers,
+ remove_marker,
+ add_marker,
get_tile_data_function,
get_omnimods_at,
get_tiles,
@@ -243,9 +245,25 @@ get_tile_data_function bmap occupied_tiles start_loc loc =
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, 0)
- else ((BattleMap.Struct.TileInstance.get_cost tile), 0)
+ (
+ (
+ if ((loc /= start_loc) && (List.member loc occupied_tiles))
+ then Constants.Movement.cost_when_occupied_tile
+ else (BattleMap.Struct.TileInstance.get_cost tile)
+ ),
+ (Set.foldl
+ (\trigger dangers_count ->
+ case (Dict.get trigger bmap.markers) of
+ Nothing -> dangers_count
+ (Just marker) ->
+ if (BattleMap.Struct.Marker.is_dangerous marker)
+ then (dangers_count + 1)
+ else dangers_count
+ )
+ 0
+ (BattleMap.Struct.TileInstance.get_triggers tile)
+ )
+ )
Nothing -> (Constants.Movement.cost_when_out_of_bounds, 0)
else