summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-03-16 13:50:09 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-03-16 13:50:09 +0100
commit20911dd1bc9f35e97f0a7bebcd5dce70747d6cf1 (patch)
treec3e16c6d4e0efc519e1f5aae24ba4d376406d897
parent407275d45a936abccc70d57ab2e96a3b93a6880d (diff)
Fixes navigator attack range when moving 1 step.
-rw-r--r--src/battlemap/src/Struct/Battlemap.elm47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/battlemap/src/Struct/Battlemap.elm b/src/battlemap/src/Struct/Battlemap.elm
index bc002ef..5a4c88c 100644
--- a/src/battlemap/src/Struct/Battlemap.elm
+++ b/src/battlemap/src/Struct/Battlemap.elm
@@ -91,31 +91,28 @@ get_movement_cost_function : (
Int
)
get_movement_cost_function bmap start_loc char_list loc =
- if
- (
- (Struct.Location.get_ref start_loc)
- ==
- (Struct.Location.get_ref loc)
- )
+ if (has_location bmap loc)
then
- 0
- else
- if (has_location bmap loc)
- then
- case
- (Array.get (location_to_index bmap loc) bmap.content)
- of
- (Just tile) ->
- if
- (List.any
- (\c -> ((Struct.Character.get_location c) == loc))
- char_list
+ case
+ (Array.get (location_to_index bmap loc) bmap.content)
+ of
+ (Just tile) ->
+ if
+ (List.any
+ (
+ \c ->
+ (
+ ((Struct.Character.get_location c) == loc)
+ && (loc /= start_loc)
+ )
)
- then
- Constants.Movement.cost_when_occupied_tile
- else
- (Struct.Tile.get_cost tile)
+ char_list
+ )
+ then
+ Constants.Movement.cost_when_occupied_tile
+ else
+ (Struct.Tile.get_cost tile)
- Nothing -> Constants.Movement.cost_when_out_of_bounds
- else
- Constants.Movement.cost_when_out_of_bounds
+ Nothing -> Constants.Movement.cost_when_out_of_bounds
+ else
+ Constants.Movement.cost_when_out_of_bounds