Skip to content

Commit ecb41b1

Browse files
committed
Implemented amulets of poison.
1 parent d13e923 commit ecb41b1

File tree

6 files changed

+54
-6
lines changed

6 files changed

+54
-6
lines changed

simalq/game_state.hy

+3-1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@
169169
; How much with the relevant artifact (and no magic arrows).
170170
player-shot-damage-magic 3
171171
; How much damage the player does with magic arrows.
172+
player-poison-damage 3
173+
; How much damage the player does with a poisonous aura.
172174
magic-arrows-pickup-size 10
173175
; How many magic arrows come in a pickup.
174176
time-bonus 25
@@ -178,7 +180,7 @@
178180
paralysis-duration 3
179181
; How many rounds paralysis lasts for.
180182
poison-emitter-damage 2
181-
; Damage per turn from poisonous fountains.
183+
; Damage per turn (to the player) from poisonous fountains.
182184
dainty-monsters T])
183185
; Whether monsters will only step on empty floor (with some
184186
; exceptions, like spiders walking on webs). Otherwise,

simalq/main.hy

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
contextlib [contextmanager]
77
simalq [version-string]
88
simalq.strings
9-
simalq.util [CommandError StatusEffect message-queue msg DamageType GameOverException menu-letters]
9+
simalq.util [CommandError StatusEffect message-queue msg DamageType GameOverException menu-letters burst-damage]
1010
simalq.color :as color
1111
simalq.geometry [burst at turn-and-pos-seed]
1212
simalq.game-state [G]
@@ -107,6 +107,16 @@
107107
(when extra-poison
108108
(.damage G.player G.rules.poison-emitter-damage DamageType.Poison)))
109109

110+
; The player herself deals out passive poison damage, if she's
111+
; poisonous.
112+
(when (.player-has? StatusEffect.Pois)
113+
(burst-damage G.player.pos
114+
:damage-type DamageType.Poison
115+
:amount (* [G.rules.player-poison-damage] 2)
116+
:color 'moss-green
117+
:quick-flash T))
118+
; This is happening every turn, so it should be fast.
119+
110120
; Tick down status effects.
111121
(for [se StatusEffect]
112122
(when (.player-has? se)

simalq/tile/item.hy

+16-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
:flavor "Looks like the ethereal power of one of those many, many evil undead phantasms rubbed off onto this little trinket. Try not to let the magic run out when you're entirely surrounded by walls. Getting buried alive is a bad way to go.")
293293
294294
(deftile "! " "a potion of speed" StatusEffectItem
295-
:color 'dark-green
295+
:color 'red
296296
:iq-ix 34
297297
:acquirement-points 100
298298
@@ -303,6 +303,21 @@
303303
f"Lets you act twice per turn for {@duration} more turns.")
304304
:flavor "This cool concoction puts a pep in your step and a swiftness in your sword-swings.")
305305
306+
(deftile "! " "an amulet of poison" StatusEffectItem
307+
:color 'dark-green
308+
:iq-ix 159
309+
; IQ calls this an "amulet of poisonous touch", but no real
310+
; touching is required, and IQ's poisonous amulets have also been
311+
; renamed, so there should be no danger of confusion there.
312+
:acquirement-points 250
313+
314+
:effect StatusEffect.Pois
315+
:duration 15
316+
317+
:help (meth []
318+
f"Surrounds you in a cloud of poison for {@duration} more turns. You are immune to the effect, but all monsters within 1 square take {G.rules.player-poison-damage} damage.")
319+
:flavor "Finally, somebody concoted a poison that hurts monsters but not you. This handy wearable fumigator lets you apply it hands-free.")
320+
306321
(deftile "! " "a cloak of invisibility" StatusEffectItem
307322
:color 'blue
308323
:iq-ix 25

simalq/tile/unimplemented.hy

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
[132 "golem"]
3131
[134 "siren"]
3232
[152 "random_gate"]
33-
[159 "amulet_of_poisonous_touch"]
3433
[164 "cyclops"]
3534
[165 "dark_prince"]
3635
[166 "blind_mage"]

simalq/util.hy

+2-2
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180

181181

182182
(defn burst-damage [
183-
center color amount damage-type [player-amount 0]]
183+
center color amount damage-type [player-amount 0] [quick-flash F]]
184184
"Damage every tile in a burst. `amount` should be a list like `[3 2
185185
1]`, which means that 3 damage is dealt at the center, 2 damage is
186186
dealt at distance 1 from the center, and so on. But note that this
@@ -199,7 +199,7 @@
199199
color
200200
:ps b
201201
:labels {}
202-
:flash-time-s .5)
202+
:flash-time-s (if quick-flash .125 .5))
203203

204204
(for [p b tile (at p) :if (isinstance tile Damageable)]
205205
(.damage tile

tests/test_item.hy

+22
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
simalq.geometry [Pos Direction at]
88
simalq.game-state [G]
99
simalq.util [StatusEffect]
10+
simalq.tile [Monster]
1011
simalq.quest-definition [mk-tile])
1112
(setv T True F False)
1213

@@ -288,6 +289,27 @@
288289
(check 21 11))
289290

290291

292+
(defn test-amulet-of-poison []
293+
(init [
294+
:map "
295+
. @ .
296+
o ! o
297+
o o o"
298+
:map-marks {
299+
"o " ["orc" :hp 10]
300+
"! " "amulet of poison"}])
301+
302+
; Pick up the amulet, doing 3 damage to all the surrounding orcs.
303+
(wk 'S)
304+
; Make another orc on our own square. Wait 1 turn, doing another
305+
; 3 damage to all of 'em.
306+
(Monster.make G.player.pos "orc" :hp 10)
307+
(wait)
308+
(for [direction ['E 'SE 'S 'SW 'W]]
309+
(assert-hp direction 4))
310+
(assert-hp 'here 7))
311+
312+
291313
(defn test-cloak-of-invisibility []
292314
(init [
293315
:map "

0 commit comments

Comments
 (0)