Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

let monsters benefit from rings of searching, as per PLAYING.markdown

  • Loading branch information...
commit e696d1f106ceb073d0309b71c85cac0967581338 1 parent d0ae836
@Mikolaj Mikolaj authored
Showing with 10 additions and 3 deletions.
  1. +4 −1 src/Actions.hs
  2. +6 −2 src/StrategyState.hs
View
5 src/Actions.hs
@@ -252,11 +252,14 @@ actorOpenClose actor v o dir =
let isPlayer = actor == pl
let isVerbose = v && isPlayer
let dloc = shift loc dir -- location we act upon
+ let openPower = case strongestItem (mitems body) "ring" of
+ Just i -> niq (mkind body) + ipower i
+ Nothing -> niq (mkind body)
in case lmap `at` dloc of
Tile d@(Door hv o') []
| secret o' && isPlayer -> -- door is secret, cannot be opened or closed by the player
neverMind isVerbose
- | maybe o ((|| not o) . (>= (niq (mkind body)))) o' ->
+ | maybe o ((|| not o) . (>= openPower)) o' ->
-- door is in unsuitable state
abortIfWith isVerbose ("already " ++ txt)
| not (unoccupied hms dloc) ->
View
8 src/StrategyState.hs
@@ -97,8 +97,12 @@ strategy actor
onlyKeepsDir_9 = only (\ x -> maybe True (\ d -> neg x /= d) mdir)
onlyUnoccupied = onlyMoves (unoccupied (levelMonsterList delState)) me
-- Monsters don't see doors more secret than that. Enforced when actually
- -- opening doors, too, so that monsters don't cheat.
- openableHere = openable (niq mk) lmap
+ -- opening doors, too, so that monsters don't cheat. TODO: remove the code
+ -- duplication, though.
+ openPower = case strongestItem items "ring" of
+ Just i -> niq mk + ipower i
+ Nothing -> niq mk
+ openableHere = openable openPower lmap
onlyOpenable = onlyMoves openableHere me
accessibleHere = accessible lmap me
onlySensible = onlyMoves (\ l -> accessibleHere l || openableHere l) me

0 comments on commit e696d1f

Please sign in to comment.
Something went wrong with that request. Please try again.