Browse files

Moved Actor type, rearranged some modules.

Heavily edited by Mikolaj for inclusion in master branch.
  • Loading branch information...
1 parent 753e2b7 commit 6a58b4d505bde59cfbb22cf258dc8abdd5db8c88 @kosmikus kosmikus committed with Mikolaj Jan 24, 2011
Showing with 242 additions and 206 deletions.
  1. +3 −2 LambdaHack.cabal
  2. +3 −35 src/Actions.hs
  3. +0 −18 src/Actor.hs
  4. +2 −0 src/Display2.hs
  5. +0 −33 src/Dungeon.hs
  6. +1 −0 src/Grammar.hs
  7. +5 −4 src/HeroState.hs
  8. +10 −0 src/ItemState.hs
  9. +36 −10 src/Monster.hs
  10. +53 −0 src/MonsterState.hs
  11. +9 −24 src/Movable.hs
  12. +111 −0 src/MovableState.hs
  13. +6 −5 src/Perception.hs
  14. +0 −73 src/State.hs
  15. +2 −1 src/StrategyState.hs
  16. +1 −1 src/Turn.hs
View
5 LambdaHack.cabal
@@ -24,13 +24,14 @@ flag vty
executable LambdaHack
main-is: LambdaHack.hs
hs-source-dirs:src
- other-modules: Actor, Action, Actions, Command, Config, ConfigDefault,
+ other-modules: Action, Actions, Command, Config, ConfigDefault,
Display, Display2, Dungeon, File,
FOV, FOV.Common, FOV.Digital, FOV.Permissive, FOV.Shadow,
Frequency, Geometry, Grammar,
HeroState, HighScores, Item, ItemState,
Keys, Keybindings, LambdaHack, Level, LevelState,
- Message, Monster, Movable, Multiline, Perception, Random,
+ Message, Monster, MonsterState, Movable, MovableState,
+ Multiline, Perception, Random,
Save, State, Strategy, StrategyState,
Turn, Version
build-depends: base >= 4 && <5, containers >= 0.1 && < 1,
View
38 src/Actions.hs
@@ -11,18 +11,20 @@ import Data.Set as S
import System.Time
import Action
-import Actor
import Display2 hiding (display)
import Dungeon
import Geometry
import Grammar
import qualified HighScores as H
import Item
+import ItemState
import qualified Keys as K
import Level
import LevelState
import Message
import Movable
+import MovableState
+import MonsterState
import Perception
import Random
import State
@@ -474,13 +476,6 @@ selectPlayer actor =
messageAdd $ subjectMovable (mtype pbody) ++ " selected."
return True
--- | Calculate loot's worth. TODO: move to another module, and refine significantly.
-calculateTotal :: State -> Int
-calculateTotal s =
- L.sum $ L.map price $ L.concatMap mitems (levelHeroList s)
- where
- price i = if iletter i == Just '$' then icount i else 10 * icount i
-
-- | Handle current score and display it with the high scores. Scores
-- should not be shown during the game, because ultimately the worth of items might give
-- information about the nature of the items.
@@ -548,23 +543,6 @@ targetMonster = do
updatePlayerBody (\ p -> p { mtarget = tgt })
setCursor tgt
--- | Calculate the location of player's target.
--- TODO: no idea in which file to put this function.
-targetToLoc :: State -> Perception -> Maybe Loc
-targetToLoc state per =
- case mtarget (getPlayerBody state) of
- TLoc loc -> Just loc
- TCursor ->
- if lname (slevel state) == clocLn (scursor state)
- then Just $ clocation (scursor state)
- else Nothing -- cursor invalid: set at a different level
- TEnemy a -> do
- (ln, m) <- findActorAnyLevel a state -- is target alive?
- guard $ ln == lname (slevel state) -- is target on current level?
- let loc = mloc m
- guard $ S.member loc (pvisible per) -- is target visible?
- return loc
-
-- | Set, activate and display cursor information.
setCursor :: Target -> Action ()
setCursor tgt = do
@@ -661,16 +639,6 @@ drinkPotion =
Nothing -> neverMind True
playerAdvanceTime
--- | Finds an actor at a location. Perception irrelevant.
-locToActor :: State -> Loc -> Maybe Actor
-locToActor state loc =
- getIndex (lmonsters, AMonster) `mplus` getIndex (lheroes, AHero)
- where
- getIndex (projection, injection) =
- let l = IM.assocs $ projection $ slevel state
- im = L.find (\ (_i, m) -> mloc m == loc) l
- in fmap (injection . fst) im
-
fireItem :: Action ()
fireItem = do
state <- get
View
18 src/Actor.hs
@@ -1,18 +0,0 @@
-module Actor where
-
-import Control.Monad
-import Data.Binary
-
-data Actor = AHero Int -- ^ hero index (on the lheroes intmap)
- | AMonster Int -- ^ monster index (on the lmonsters intmap)
- deriving (Show, Eq)
-
-instance Binary Actor where
- put (AHero n) = putWord8 0 >> put n
- put (AMonster n) = putWord8 1 >> put n
- get = do
- tag <- getWord8
- case tag of
- 0 -> liftM AHero get
- 1 -> liftM AMonster get
- _ -> fail "no parse (Actor)"
View
2 src/Display2.hs
@@ -17,6 +17,8 @@ import LevelState
import Dungeon
import Perception
import Movable
+import MovableState
+import Monster
import Item
import Keys as K
View
33 src/Dungeon.hs
@@ -4,16 +4,12 @@ import Prelude hiding (floor)
import Control.Monad
import Data.Map as M
-import qualified Data.IntMap as IM
import Data.List as L
import Data.Ratio
import Data.Maybe
-import State
import Geometry
import Level
-import Movable
-import Monster
import Item
import Random
@@ -304,32 +300,3 @@ digRoom dl ((y0,x0),(y1,x1)) l
++ [ ((y,x),newTile (Wall p)) | x <- [x0..x1], (y,p) <- [(y0-1,U),(y1+1,D)] ]
++ [ ((y,x),newTile (Wall p)) | (x,p) <- [(x0-1,L),(x1+1,R)], y <- [y0..y1] ]
in M.unionWith const rm l
-
--- TODO: do the functions below belong in this module?
--- | Create a new monster in the level, at a random position.
-addMonster :: State -> Rnd Level
-addMonster state@(State { slevel = lvl@(Level { lmap = lmap }),
- sdungeon = Dungeon m }) =
- do
- let hs = levelHeroList state
- ms = levelMonsterList state
- rc <- monsterGenChance (lname lvl) ms
- if rc
- then
- do
- let f lvl = let mms = lmonsters lvl
- in if IM.null mms then -1 else fst (IM.findMax mms)
- maxes = L.map f (lvl : M.elems m)
- ni = 1 + L.maximum maxes
- -- TODO: new monsters should always be generated in a place that isn't
- -- visible by the player (if possible -- not possible for bigrooms)
- -- levels with few rooms are dangerous, because monsters may spawn
- -- in adjacent and unexpected places
- sm <- findLocTry 1000 lvl
- (\ l t -> open t
- && not (l `L.elem` L.map mloc (hs ++ ms)))
- (\ l t -> floor t
- && L.all (\pl -> distance (mloc pl, l) > 400) hs)
- m <- newMonster sm monsterFrequency
- return (updateMonsters (IM.insert ni m) lvl)
- else return lvl
View
1 src/Grammar.hs
@@ -3,6 +3,7 @@ module Grammar where
import Data.Char
import Item
+import Monster
import Movable
import State
import ItemState
View
9 src/HeroState.hs
@@ -8,12 +8,13 @@ import Data.Maybe
import Geometry
import qualified Config
import Movable
+import MovableState
+import Monster
import Level
import State
--- | Initial hero.
-defaultHero :: Char -> String -> Loc -> Int -> Movable
-defaultHero symbol name ploc hp =
+templateHero :: Char -> String -> Loc -> Int -> Movable
+templateHero symbol name ploc hp =
Movable (Hero symbol name) hp hp Nothing TCursor ploc [] 'a' 10 0
-- | Create a new hero on the current level, close to the given location.
@@ -25,7 +26,7 @@ addHero ploc hp name state@(State { slevel = Level { lmap = map } }) n =
good l = open (map `at` l) && not (l `L.elem` L.map mloc (hs ++ ms))
place = fromMaybe (error "no place for a hero") $ L.find good places
symbol = if n < 1 || n > 9 then '@' else Char.intToDigit n
- hero = defaultHero symbol name place hp
+ hero = templateHero symbol name place hp
in updateLevel (updateHeroes (IM.insert n hero)) state
-- | Create a set of new heroes on the current level, at location ploc.
View
10 src/ItemState.hs
@@ -2,9 +2,12 @@ module ItemState where
import Data.Set as S
import Data.Map as M
+import Data.List as L
import Item
import State
+import Movable
+import MovableState
identified :: Assocs -> Discoveries -> ItemType -> String -> String
identified a d i
@@ -14,3 +17,10 @@ identified a d i
| otherwise = case M.lookup i a of
Just ap -> appearance ap
_ -> ("really strange " ++)
+
+-- | Calculate loot's worth. TODO: refine significantly.
+calculateTotal :: State -> Int
+calculateTotal s =
+ L.sum $ L.map price $ L.concatMap mitems (levelHeroList s)
+ where
+ price i = if iletter i == Just '$' then icount i else 10 * icount i
View
46 src/Monster.hs
@@ -1,10 +1,20 @@
module Monster where
+import Data.Binary
+import Control.Monad
+
import Geometry
import Random
-import Movable
+import Display
+
+-- TODO: move _all_ monster data here from Grammar.hs, etc.
--- TODO: move more monster data here from Movable.hs, Grammar.hs, etc.
+data MovableType =
+ Hero Char String
+ | Eye
+ | FastEye
+ | Nose
+ deriving (Show, Eq)
-- | Monster frequencies (TODO: should of course vary much more
-- on local circumstances).
@@ -18,24 +28,40 @@ monsterFrequency =
]
-- | Generate monster.
-newMonster :: Loc -> Frequency MovableType -> Rnd Movable
-newMonster loc ftp =
+newMonster :: (MovableType -> Int -> Loc -> Int -> a) ->
+ Loc -> Frequency MovableType -> Rnd a
+newMonster template loc ftp =
do
tp <- frequency ftp
hp <- hps tp
let s = speed tp
return (template tp hp loc s)
where
- -- setting the time of new monsters to 0 makes them able to
- -- move immediately after generation; this does not seem like
- -- a bad idea, but it would certainly be "more correct" to set
- -- the time to the creation time instead
- template tp hp loc s = Movable tp hp hp Nothing TCursor loc [] 'a' s 0
-
hps Eye = randomR (1,12) -- falls in 1--4 unarmed rounds
hps FastEye = randomR (1,6) -- 1--2
hps Nose = randomR (6,13) -- 2--5 and in 1 round of the strongest sword
speed Eye = 10
speed FastEye = 4
speed Nose = 11
+
+-- Heroes are white, monsters are colorful.
+viewMovable :: MovableType -> (Char, AttrColor)
+viewMovable (Hero sym _) = (sym, white)
+viewMovable Eye = ('e', red)
+viewMovable FastEye = ('e', blue)
+viewMovable Nose = ('n', green)
+
+instance Binary MovableType where
+ put (Hero symbol name) = putWord8 0 >> put symbol >> put name
+ put Eye = putWord8 1
+ put FastEye = putWord8 2
+ put Nose = putWord8 3
+ get = do
+ tag <- getWord8
+ case tag of
+ 0 -> liftM2 Hero get get
+ 1 -> return Eye
+ 2 -> return FastEye
+ 3 -> return Nose
+ _ -> fail "no parse (MovableType)"
View
53 src/MonsterState.hs
@@ -0,0 +1,53 @@
+module MonsterState where
+
+import Prelude hiding (floor)
+import qualified Data.IntMap as IM
+import Data.List as L
+import Data.Map as M
+
+import Geometry
+import State
+import Level
+import Dungeon
+import Movable
+import MovableState
+import Monster
+import Random
+
+-- setting the time of new monsters to 0 makes them able to
+-- move immediately after generation; this does not seem like
+-- a bad idea, but it would certainly be "more correct" to set
+-- the time to the creation time instead
+templateMonster :: MovableType -> Int -> Loc -> Int -> Movable
+templateMonster tp hp loc s =
+ Movable tp hp hp Nothing TCursor loc [] 'a' s 0
+
+newMonsterIndex :: State -> Int
+newMonsterIndex (State { slevel = lvl, sdungeon = Dungeon m }) =
+ let f lvl = let mms = lmonsters lvl
+ in if IM.null mms then -1 else fst (IM.findMax mms)
+ maxes = L.map f (lvl : M.elems m)
+ in 1 + L.maximum maxes
+
+-- | Create a new monster in the level, at a random position.
+addMonster :: State -> Rnd Level
+addMonster state@(State { slevel = lvl }) = do
+ let hs = levelHeroList state
+ ms = levelMonsterList state
+ rc <- monsterGenChance (lname lvl) ms
+ if rc
+ then
+ do
+ let ni = newMonsterIndex state
+ -- TODO: new monsters should always be generated in a place that isn't
+ -- visible by the player (if possible -- not possible for bigrooms)
+ -- levels with few rooms are dangerous, because monsters may spawn
+ -- in adjacent and unexpected places
+ sm <- findLocTry 1000 lvl
+ (\ l t -> open t
+ && not (l `L.elem` L.map mloc (hs ++ ms)))
+ (\ l t -> floor t
+ && L.all (\pl -> distance (mloc pl, l) > 400) hs)
+ m <- newMonster templateMonster sm monsterFrequency
+ return (updateMonsters (IM.insert ni m) lvl)
+ else return lvl
View
33 src/Movable.hs
@@ -3,10 +3,9 @@ module Movable where
import Data.Binary
import Control.Monad
-import Actor
import Geometry
-import Display
import Item
+import Monster
data Movable = Movable
{ mtype :: !MovableType,
@@ -49,26 +48,19 @@ instance Binary Movable where
mtime <- get
return (Movable mt mhpm mhp md tgt ml minv mletter mspeed mtime)
-data MovableType =
- Hero Char String
- | Eye
- | FastEye
- | Nose
+data Actor = AHero Int -- ^ hero index (on the lheroes intmap)
+ | AMonster Int -- ^ monster index (on the lmonsters intmap)
deriving (Show, Eq)
-instance Binary MovableType where
- put (Hero symbol name) = putWord8 0 >> put symbol >> put name
- put Eye = putWord8 1
- put FastEye = putWord8 2
- put Nose = putWord8 3
+instance Binary Actor where
+ put (AHero n) = putWord8 0 >> put n
+ put (AMonster n) = putWord8 1 >> put n
get = do
tag <- getWord8
case tag of
- 0 -> liftM2 Hero get get
- 1 -> return Eye
- 2 -> return FastEye
- 3 -> return Nose
- _ -> fail "no parse (MovableType)"
+ 0 -> liftM AHero get
+ 1 -> liftM AMonster get
+ _ -> fail "no parse (Actor)"
data Target =
TEnemy Actor -- ^ fire at the actor (a monster or a hero)
@@ -87,10 +79,3 @@ instance Binary Target where
1 -> liftM TLoc get
2 -> return TCursor
_ -> fail "no parse (Target)"
-
--- Heroes are white, monsters are colorful.
-viewMovable :: MovableType -> (Char, AttrColor)
-viewMovable (Hero sym _) = (sym, white)
-viewMovable Eye = ('e', red)
-viewMovable FastEye = ('e', blue)
-viewMovable Nose = ('n', green)
View
111 src/MovableState.hs
@@ -0,0 +1,111 @@
+module MovableState where
+
+import qualified Data.List as L
+import qualified Data.Set as S
+import qualified Data.Map as M
+import qualified Data.IntMap as IM
+import Control.Monad
+import Data.Maybe
+
+import Geometry
+import Movable
+import Level
+import State
+import Perception
+
+-- The operations with "Any", and those that use them, consider all the dungeon.
+-- All the other actor and level operations only consider the current level.
+
+-- | Finds an actor body on any level. Error if not found.
+findActorAnyLevel :: Actor -> State -> Maybe (LevelName, Movable)
+findActorAnyLevel actor state@(State { slevel = lvl,
+ sdungeon = Dungeon m }) =
+ let chk lvl =
+ fmap (\ m -> (lname lvl, m)) $
+ case actor of
+ AHero n -> IM.lookup n (lheroes lvl)
+ AMonster n -> IM.lookup n (lmonsters lvl)
+ in listToMaybe $ mapMaybe chk (lvl : M.elems m)
+
+getPlayerBody :: State -> Movable
+getPlayerBody state = snd $ fromMaybe (error "getPlayerBody") $
+ findActorAnyLevel (splayer state) state
+
+-- | The list of actors and levels for all heroes in the dungeon.
+-- Heroes from the current level go first.
+allHeroesAnyLevel :: State -> [(Actor, LevelName)]
+allHeroesAnyLevel state =
+ let Dungeon m = sdungeon state
+ one (Level { lname = ln, lheroes = hs }) =
+ L.map (\ (i, _) -> (AHero i, ln)) (IM.assocs hs)
+ in L.concatMap one (slevel state : M.elems m)
+
+updateAnyActorBody :: Actor -> (Movable -> Movable) -> State -> State
+updateAnyActorBody actor f state =
+ case findActorAnyLevel actor state of
+ Just (ln, _) ->
+ case actor of
+ AHero n -> updateAnyLevel (updateHeroes $ IM.adjust f n) ln state
+ AMonster n -> updateAnyLevel (updateMonsters $ IM.adjust f n) ln state
+ Nothing -> error "updateAnyActorBody"
+
+updateAnyLevel :: (Level -> Level) -> LevelName -> State -> State
+updateAnyLevel f ln state@(State { slevel = level,
+ sdungeon = Dungeon dng })
+ | ln == lname level = updateLevel f state
+ | otherwise = updateDungeon (const $ Dungeon $ M.adjust f ln dng) state
+
+-- | Calculate the location of player's target.
+targetToLoc :: State -> Perception -> Maybe Loc
+targetToLoc state per =
+ case mtarget (getPlayerBody state) of
+ TLoc loc -> Just loc
+ TCursor ->
+ if lname (slevel state) == clocLn (scursor state)
+ then Just $ clocation (scursor state)
+ else Nothing -- cursor invalid: set at a different level
+ TEnemy a -> do
+ (ln, m) <- findActorAnyLevel a state -- is target alive?
+ guard $ ln == lname (slevel state) -- is target on current level?
+ let loc = mloc m
+ guard $ S.member loc (pvisible per) -- is target visible?
+ return loc
+
+-- The operations below disregard levels other than the current.
+
+-- | Gets actor body from the current level. Error if not found.
+getActor :: State -> Actor -> Movable
+getActor (State { slevel = lvl }) a =
+ case a of
+ AHero n -> lheroes lvl IM.! n
+ AMonster n -> lmonsters lvl IM.! n
+
+-- | Removes the actor, if present, from the current level.
+deleteActor :: Actor -> State -> State
+deleteActor a =
+ case a of
+ AHero n -> updateLevel (updateHeroes (IM.delete n))
+ AMonster n -> updateLevel (updateMonsters (IM.delete n))
+
+-- | Add actor to the current level.
+insertActor :: Actor -> Movable -> State -> State
+insertActor a m =
+ case a of
+ AHero n -> updateLevel (updateHeroes (IM.insert n m))
+ AMonster n -> updateLevel (updateMonsters (IM.insert n m))
+
+levelHeroList :: State -> [Movable]
+levelHeroList (State { slevel = Level { lheroes = hs } }) = IM.elems hs
+
+levelMonsterList :: State -> [Movable]
+levelMonsterList (State { slevel = Level { lmonsters = ms } }) = IM.elems ms
+
+-- | Finds an actor at a location on the current level. Perception irrelevant.
+locToActor :: State -> Loc -> Maybe Actor
+locToActor state loc =
+ getIndex (lmonsters, AMonster) `mplus` getIndex (lheroes, AHero)
+ where
+ getIndex (projection, injection) =
+ let l = IM.assocs $ projection $ slevel state
+ im = L.find (\ (_i, m) -> mloc m == loc) l
+ in fmap (injection . fst) im
View
11 src/Perception.hs
@@ -1,7 +1,8 @@
module Perception where
-import Data.Set as S
+import qualified Data.Set as S
import Data.List as L
+import qualified Data.IntMap as IM
import Geometry
import State
@@ -11,10 +12,10 @@ import FOV
import qualified Config
data Perception =
- Perception { preachable :: Set Loc, pvisible :: Set Loc }
+ Perception { preachable :: S.Set Loc, pvisible :: S.Set Loc }
perception_ :: State -> Perception
-perception_ state@(State { slevel = Level { lmap = lmap },
+perception_ state@(State { slevel = Level { lmap = lmap, lheroes = hs },
sconfig = config,
ssensory = sensory }) =
let mode = Config.get config "engine" "fovMode"
@@ -34,8 +35,8 @@ perception_ state@(State { slevel = Level { lmap = lmap },
_ -> error $ "perception_: unknown mode: " ++ show mode
- hs = levelHeroList state
- pers = L.map (\ pl -> perception fovMode (mloc pl) lmap) hs
+ lhs = IM.elems hs
+ pers = L.map (\ pl -> perception fovMode (mloc pl) lmap) lhs
reachable = S.unions (L.map preachable pers)
visible = S.unions (L.map pvisible pers)
-- TODO: update individual hero perceptions here; see https://github.com/Mikolaj/LambdaHack/issues/issue/31
View
73 src/State.hs
@@ -1,15 +1,11 @@
module State where
-import qualified Data.List as L
import qualified Data.Map as M
-import qualified Data.IntMap as IM
import qualified Data.Set as S
import Control.Monad
import Data.Binary
-import Data.Maybe
import qualified Config
-import Actor
import Movable
import Geometry
import Level
@@ -58,75 +54,6 @@ defaultState dng lvl =
lvl
(Config.defaultCP)
--- The operations with "Any", and those that use them, consider all the dungeon.
--- All the other actor and level operations only consider the current level.
-
--- | Finds an actor body on any level. Error if not found.
-findActorAnyLevel :: Actor -> State -> Maybe (LevelName, Movable)
-findActorAnyLevel actor state@(State { slevel = lvl,
- sdungeon = Dungeon m }) =
- let chk lvl =
- fmap (\ m -> (lname lvl, m)) $
- case actor of
- AHero n -> IM.lookup n (lheroes lvl)
- AMonster n -> IM.lookup n (lmonsters lvl)
- in listToMaybe $ mapMaybe chk (lvl : M.elems m)
-
-getPlayerBody :: State -> Movable
-getPlayerBody state = snd $ fromMaybe (error "getPlayerBody") $
- findActorAnyLevel (splayer state) state
-
--- | The list of actors and levels for all heroes in the dungeon.
--- Heroes from the current level go first.
-allHeroesAnyLevel :: State -> [(Actor, LevelName)]
-allHeroesAnyLevel state =
- let Dungeon m = sdungeon state
- one (Level { lname = ln, lheroes = hs }) =
- L.map (\ (i, _) -> (AHero i, ln)) (IM.assocs hs)
- in L.concatMap one (slevel state : M.elems m)
-
-updateAnyActorBody :: Actor -> (Movable -> Movable) -> State -> State
-updateAnyActorBody actor f state =
- case findActorAnyLevel actor state of
- Just (ln, _) ->
- case actor of
- AHero n -> updateAnyLevel (updateHeroes $ IM.adjust f n) ln state
- AMonster n -> updateAnyLevel (updateMonsters $ IM.adjust f n) ln state
- Nothing -> error "updateAnyActorBody"
-
-updateAnyLevel :: (Level -> Level) -> LevelName -> State -> State
-updateAnyLevel f ln state@(State { slevel = level,
- sdungeon = Dungeon dng })
- | ln == lname level = updateLevel f state
- | otherwise = updateDungeon (const $ Dungeon $ M.adjust f ln dng) state
-
--- | Gets actor body from the current level. Error if not found.
-getActor :: State -> Actor -> Movable
-getActor (State { slevel = lvl }) a =
- case a of
- AHero n -> lheroes lvl IM.! n
- AMonster n -> lmonsters lvl IM.! n
-
--- | Removes the actor, if present, from the current level.
-deleteActor :: Actor -> State -> State
-deleteActor a =
- case a of
- AHero n -> updateLevel (updateHeroes (IM.delete n))
- AMonster n -> updateLevel (updateMonsters (IM.delete n))
-
--- | Add actor to the current level.
-insertActor :: Actor -> Movable -> State -> State
-insertActor a m =
- case a of
- AHero n -> updateLevel (updateHeroes (IM.insert n m))
- AMonster n -> updateLevel (updateMonsters (IM.insert n m))
-
-levelHeroList :: State -> [Movable]
-levelHeroList (State { slevel = Level { lheroes = hs } }) = IM.elems hs
-
-levelMonsterList :: State -> [Movable]
-levelMonsterList (State { slevel = Level { lmonsters = ms } }) = IM.elems ms
-
updateCursor :: (Cursor -> Cursor) -> State -> State
updateCursor f s = s { scursor = f (scursor s) }
View
3 src/StrategyState.hs
@@ -8,11 +8,12 @@ import qualified Data.IntMap as IM
import Geometry
import Level
import Movable
+import MovableState
+import Monster
import Random
import Perception
import Strategy
import State
-import Actor
strategy :: Actor -> State -> Perception -> Strategy Dir
strategy actor
View
2 src/Turn.hs
@@ -10,14 +10,14 @@ import qualified Data.Char as Char
import Action
import Actions
-import Actor
import Command
import qualified Config
import Display2 hiding (display)
import Keybindings
import qualified Keys as K
import Level
import Movable
+import MovableState
import Random
import State
import Strategy

0 comments on commit 6a58b4d

Please sign in to comment.