blob: b80eda7a62094600f4e1eb7470d10a32dd8a5d40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
module Update.SelectCharacter exposing (apply_to)
import Dict
import Character
import Battlemap
import Battlemap.Direction
import Battlemap.Navigator
import Battlemap.Tile
import Model
apply_to : Model.Type -> Character.Ref -> Model.Type
apply_to model char_id =
{model |
selection = (Just char_id),
battlemap =
(Battlemap.apply_to_all_tiles
model.battlemap
(Battlemap.Tile.set_navigation Battlemap.Direction.None)
),
navigator =
(case (Dict.get char_id model.characters) of
Nothing -> Nothing
(Just char) ->
(Just
(Battlemap.Navigator.new_navigator
char.location
char.movement_points
)
)
)
}
|