Skip to content

Commit c353d56

Browse files
committed
Implemented poison-gas bombs.
1 parent 1efc4c4 commit c353d56

File tree

3 files changed

+71
-42
lines changed

3 files changed

+71
-42
lines changed

simalq/tile/item.hy

+34-12
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,15 @@
193193
:hp-effect -50
194194
:eat-messages #("You drink a jar of poison. It tastes pretty bad.")
195195
196+
; Define the shot effect in terms of poison-gas bombs.
197+
:!pb (meth []
198+
(get Tile.types "poison-gas bomb"))
196199
:hook-player-shot (meth []
197-
(doc #[f[Explodes in {(burst-size poison-burst.size)} of poison, which does {poison-burst.mon-damage} poison damage to monsters and {poison-burst.player-damage} to you.]f])
198-
(burst-damage @pos :damage-type DamageType.Poison
199-
:amount (*
200-
[poison-burst.mon-damage]
201-
(+ 1 poison-burst.size))
202-
:color 'moss-green
203-
:player-amount poison-burst.player-damage)
200+
(doc (.dynadoc (. (@pb) use) (@pb)))
201+
(.use (@pb) ((@pb)) @pos)
204202
(@rm-from-map))
205203
206204
:flavor "I think you're not supposed to drink this.")
207-
(setv poison-burst (MetaDict
208-
:size 2
209-
:player-damage 20
210-
:mon-damage 3))
211205
212206
;; --------------------------------------------------------------
213207
;; * Miscellany
@@ -575,7 +569,7 @@
575569
(@rm-from-map)))
576570
577571
(deftile "0 " "a standard bomb" FireBomb
578-
:color 'dark-green
572+
:color 'brown
579573
:iq-ix 31 ; Just called a "bomb" in IQ
580574
:acquirement-points 100
581575
@@ -605,6 +599,34 @@
605599
:flavor "Heavy ordnance. Kills monsters dead, with a bomb pattern that would put a feather in Colonel Cathcart's cap.\n\n \"Kaboom?\"\n \"Yes, Rico. Kaboom.\"")
606600
607601
602+
(deftile "0 " "a poison-gas bomb" Usable
603+
:color 'dark-green
604+
:iq-ix 121
605+
:acquirement-points 150
606+
607+
:!player-damage 20
608+
:!mon-damage 3
609+
:!use-burst-size 3
610+
:!shot-burst-size 2
611+
612+
:!bomb-burst (meth [pos size]
613+
(burst-damage pos :damage-type DamageType.Poison
614+
:amount (* [@mon-damage] size)
615+
:color 'moss-green
616+
:player-amount @player-damage))
617+
618+
:use (meth [target]
619+
(doc f"Explodes in {(burst-size @use-burst-size)} of poison, which does {@mon-damage} poison damage to monsters and {@player-damage} to you.")
620+
(@bomb-burst target @use-burst-size))
621+
622+
:hook-player-shot (meth []
623+
(doc f"As when applied, but with a smaller {(burst-size @shot-burst-size :article? F)}.")
624+
(@bomb-burst @pos @shot-burst-size)
625+
(@rm-from-map))
626+
627+
:flavor "A lot of highly concentrated toxic gas, coupled with an explosive that quickly disperses it. Such poisons are indiscriminate in their death-dealing. Well, that's not true. They discriminate thoroughly in favor of the many poison-proof monsters. They just won't hold back on you.\n\n Chemical Weapons Convention? More like Chemical Weapons Suggestion.")
628+
629+
608630
(deftile "0 " "an earthquake bomb" Usable
609631
:color 'dark-orange
610632
:iq-ix 157

simalq/tile/unimplemented.hy

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
(do-mac `(do ~@(gfor [iq-ix stem] [
2525

2626
[106 "wand_of_gating"]
27-
[121 "poison_gas_bomb"]
2827
[129 "archdevil"]
2928
[130 "exit_mobile"]
3029
[132 "golem"]

tests/test_item.hy

+37-29
Original file line numberDiff line numberDiff line change
@@ -137,40 +137,48 @@
137137

138138

139139
(defn test-food-shoot []
140+
"We also test poison-gas bombs here, because they have the same
141+
effect when used as a jar of poison does when shot."
142+
140143
(init [
141-
:map "
142-
@ % ☠ ██o o
143-
████##██G ██
144-
████o ██████"
145-
:map-marks {
146-
"% " "snack"
147-
"" "jar of poison"
148-
"##" ["cracked wall" :hp 2]
149-
"o " ["orc" :hp 4]}])
144+
:tiles ["snack"]])
150145
; Shooting a snack (or most other foods) just destroys it.
151146
(assert-at 'E "snack")
152147
(shoot 'E)
153148
(assert-at 'E 'floor)
154-
; Shooting a jar of poison creates a 5 × 5 cloud of poison, which
155-
; can damage both the player and monsters. It goes through walls.
156-
(wk 'E)
157-
(assert-at 'E "jar of poison")
158-
(assert (= G.player.hp 100))
159-
(shoot 'E)
160-
(assert-at 'E 'floor)
161-
; The player takes 20 damage.
162-
(assert (= G.player.hp 80))
163-
; The two orcs in the blast radius take 3 damage each.
164-
(assert-hp [2 0] 1)
165-
(assert-hp [4 2] 1)
166-
; The ghost, being undead, takes no damage from poison.
167-
(assert-hp [4 1] 1)
168-
; Cracked walls are also immune to poison.
169-
(assert-hp [2 1] 2)
170-
; The third orc is outside of the blast radius.
171-
(assert-hp [5 2] 4)
172-
; Points are earned for all damage dealt.
173-
(assert (= G.score (py "3*3 + 3*3"))))
149+
150+
(for [use-bomb? [F T]]
151+
(init [
152+
:map "
153+
@ ☠ ██o o
154+
██##██G ██
155+
██o ██████"
156+
:map-marks {
157+
"" "jar of poison"
158+
"##" ["cracked wall" :hp 2]
159+
"o " ["orc" :hp 4]}])
160+
; Shooting a jar of poison (or using a poison-gas bomb) creates a
161+
; 5 × 5 cloud of poison, which can damage both the player and
162+
; monsters. It goes through walls.
163+
(assert-at 'E "jar of poison")
164+
(assert (= G.player.hp 100))
165+
(if use-bomb?
166+
(use-item "poison-gas bomb" 1 2)
167+
(shoot 'E))
168+
(assert-at 'E (if use-bomb? "jar of poison" 'floor))
169+
; The player takes 20 damage.
170+
(assert (= G.player.hp 80))
171+
; The two orcs in the blast radius take 3 damage each.
172+
(assert-hp [1 0] 1)
173+
(assert-hp [3 2] 1)
174+
; The ghost, being undead, takes no damage from poison.
175+
(assert-hp [3 1] 1)
176+
; Cracked walls are also immune to poison.
177+
(assert-hp [1 1] 2)
178+
; The third orc is outside of the blast radius.
179+
(assert-hp [4 2] 4)
180+
; Points are earned for all damage dealt.
181+
(assert (= G.score (py "3*3 + 3*3")))))
174182

175183

176184
(defn test-amulet-of-invulnerability []

0 commit comments

Comments
 (0)