Skip to content

Commit e6d4309

Browse files
committed
Slightly refactored the handling of unknown potions.
1 parent fbacfb9 commit e6d4309

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

simalq/tile/item.hy

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@
132132
(+= G.player.hp (refactor-hp @hp-effect)))))
133133
134134
(setv (get Tile.types-by-iq-ix 21) (fn [pos _ te-v2]
135-
; IQ's three types of unknown potion are mapped to items with fixed
136-
; HP effects equal to the mean HP effect of the given type.
137-
[(
138-
(get Tile.types
139-
(get ["meal" "empty platter" "rotten food"] (- te-v2 1)))
140-
:pos pos)]))
135+
[(unknown-potion pos te-v2)]))
136+
137+
(defn unknown-potion [pos i]
138+
"IQ's three types of unknown potion are mapped to items with fixed
139+
HP effects equal to the mean HP effect of the given type."
140+
((get Tile.types
141+
(get ["meal" "empty platter" "rotten food"] (- i 1)))
142+
:pos pos))
141143
142144
(deftile "% " "a meal" Food
143145
:color 'red

simalq/tile/scenery.hy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@
278278
; on top of the item contained within.
279279
[
280280
((get Tile.types "treasure chest") :pos pos)
281-
#* (if (= te-v1 21) ; An unknown potion
282-
((get Tile.types-by-iq-ix te-v1) pos None te-v2)
283-
[((get Tile.types-by-iq-ix te-v1) :pos pos)])]))
281+
(if (= te-v1 21) ; An unknown potion
282+
(hy.I.simalq/tile/item.unknown-potion pos te-v2)
283+
((get Tile.types-by-iq-ix te-v1) :pos pos))]))
284284

285285
;; --------------------------------------------------------------
286286
;; ** Metal doors

0 commit comments

Comments
 (0)