Permalink
Browse files

do not let on a secret door position by disallowing search via bumping

  • Loading branch information...
1 parent 71c7038 commit fc550fc5a9d6c89d68fea9f2f1aa3370491c0297 @Mikolaj Mikolaj committed Apr 17, 2011
Showing with 10 additions and 3 deletions.
  1. +2 −1 src/Actions.hs
  2. +4 −2 src/Level.hs
  3. +4 −0 src/Terrain.hs
View
@@ -533,7 +533,8 @@ moveOrAttack allowAttacks autoOpen actor dir
when (actor == pl) $
messageAdd $ lookAt False True state lmap tloc ""
advanceTime actor
- else if allowAttacks && actor == pl && wall (lmap `at` tloc) then do
+ else if allowAttacks && actor == pl
+ && canBeDoor (lmap `rememberAt` tloc) then do
messageAdd "You search your surroundings." -- TODO: proper msg
search
else if autoOpen then
View
@@ -108,8 +108,10 @@ closed = not . open
floor :: Tile -> Bool
floor = Terrain.isFloor . tterrain
-wall :: Tile -> Bool
-wall = Terrain.isWall . tterrain
+canBeDoor :: Tile -> Bool
+canBeDoor t = Terrain.isWall (tterrain t) ||
+ Terrain.isRock (tterrain t) ||
+ Terrain.isUnknown (tterrain t)
secret :: Maybe Int -> Bool
secret (Just n) | n /= 0 = True
View
@@ -106,6 +106,10 @@ isWall :: Terrain a -> Bool
isWall (Wall _) = True
isWall _ = False
+isRock :: Terrain a -> Bool
+isRock Rock = True
+isRock _ = False
+
isUnknown :: Terrain a -> Bool
isUnknown Unknown = True
isUnknown _ = False

0 comments on commit fc550fc

Please sign in to comment.