Permalink
Browse files

in look mode, differentiate between "look" and "remember"

  • Loading branch information...
1 parent 20a0752 commit 0ec213342960f9698a3a9341852915c0b413a2c7 @Mikolaj Mikolaj committed Mar 27, 2011
Showing with 16 additions and 12 deletions.
  1. +6 −5 src/Actions.hs
  2. +10 −7 src/LevelState.hs
View
@@ -578,8 +578,9 @@ doLook =
lmap <- gets (lmap . slevel)
per <- currentPerception
target <- gets (mtarget . getPlayerBody)
- let monsterMsg =
- if S.member loc (ptvisible per)
+ let canSee = S.member loc (ptvisible per)
+ monsterMsg =
+ if canSee
then case L.find (\ m -> mloc m == loc) (levelMonsterList state) of
Just m -> subjectMovable (mkind m) ++ " is here. "
Nothing -> ""
@@ -589,7 +590,7 @@ doLook =
TLoc _ -> "[targeting location] "
TCursor -> "[targeting current] "
-- general info about current loc
- lookMsg = mode ++ lookAt True state lmap loc monsterMsg
+ lookMsg = mode ++ lookAt True canSee state lmap loc monsterMsg
-- check if there's something lying around at current loc
t = lmap `at` loc
if length (titems t) <= 2
@@ -865,13 +866,13 @@ moveOrAttack allowAttacks autoOpen actor dir
else if accessible lmap sloc tloc then do
-- Switching positions requires full access.
actorRunActor actor target
- when (actor == pl) $ message $ lookAt False state lmap tloc ""
+ when (actor == pl) $ message $ lookAt False True state lmap tloc ""
else abort
Nothing ->
if accessible lmap sloc tloc then do
-- perform the move; TODO: make this a separate function
updateAnyActor actor $ \ m -> m { mloc = tloc }
- when (actor == pl) $ message $ lookAt False state lmap tloc ""
+ when (actor == pl) $ message $ lookAt False True state lmap tloc ""
advanceTime actor
else if autoOpen then
-- try to open a door
View
@@ -15,17 +15,20 @@ viewTile b (Tile t (i:_)) a = Item.viewItem (ikind i) a
-- | Produces a textual description of the terrain and items at an already
-- explored location. Mute for unknown locations.
-- The "detailed" variant is for use in the targeting mode.
-lookAt :: Bool -> State -> LMap -> Loc -> String -> String
-lookAt detailed s lmap loc msg
+lookAt :: Bool -> Bool -> State -> LMap -> Loc -> String -> String
+lookAt detailed canSee s lmap loc msg
| detailed =
Terrain.lookTerrain (tterrain (lmap `rememberAt` loc)) ++ " " ++ msg ++ isd
| otherwise = msg ++ isd
where
is = titems (lmap `rememberAt` loc)
+ prefixSee = if canSee then "You see " else "You remember "
+ prefixThere = if canSee
+ then "There are several objects here"
+ else "You remember several objects here"
isd = case is of
[] -> ""
- [i] -> "You see " ++ objectItem s i ++ "."
- [i,j] -> "You see " ++ objectItem s i ++ " and "
- ++ objectItem s j ++ "."
- _ -> "There are several objects here" ++
- if detailed then ":" else "."
+ [i] -> prefixSee ++ objectItem s i ++ "."
+ [i,j] -> prefixSee ++ objectItem s i ++ " and "
+ ++ objectItem s j ++ "."
+ _ -> prefixThere ++ if detailed then ":" else "."

0 comments on commit 0ec2133

Please sign in to comment.