Skip to content

Commit ab12e9c

Browse files
committed
Implemented explosive walls.
1 parent a480838 commit ab12e9c

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

simalq/tile/scenery.hy

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
fractions [Fraction :as f/]
1111
toolz [unique]
1212
simalq.color :as color
13-
simalq.util [CommandError DamageType next-in-cycle StatusEffect]
13+
simalq.util [CommandError DamageType next-in-cycle StatusEffect burst-damage]
1414
simalq.geometry [Pos Direction at burst dist dir-to ray]
1515
simalq.tile [Tile Actor PosHooked EachTurner Damageable annihilate]
1616
simalq.game-state [G])
@@ -589,6 +589,29 @@
589589
590590
:flavor "An immobile switch that toggles phasing walls. Tris's expertise in target shooting allows her to trigger one of these with a single arrow.")
591591
592+
593+
(deftile "X█" "an explosive wall" Wallish
594+
:color #('pale-orange None)
595+
:color-bg #('black None)
596+
:iq-ix 207 ; exploding wall
597+
598+
:$damage 3
599+
600+
:hook-player-bump (meth [origin]
601+
(doc f"Explodes in a 3-by-3 burst of fire, doing {@damage} damage to monsters (but not harming you) and setting off any other explosive walls in the area.")
602+
(setv target @pos)
603+
(@rm-from-map)
604+
(for [
605+
pos (burst-damage target :damage-type DamageType.Fire
606+
:amount [@damage @damage]
607+
:color 'orange)
608+
tile (list (at pos))
609+
:if (= tile.stem "explosive wall")]
610+
(.hook-player-bump tile None))
611+
T)
612+
613+
:flavor "This section of stonework is packed with bombs. Just one good smack could set them all off.")
614+
592615
;; --------------------------------------------------------------
593616
;; * Pushblocks
594617
;; --------------------------------------------------------------

simalq/tile/unimplemented.hy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
[202 "rotation_trap"]
2424
[204 "vampire"]
2525
[205 "moving_wall"]
26-
[207 "exploding_wall"]
2726
[209 "snitch"]
2827
[210 "dark_king"]]
2928

tests/test_scenery.hy

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,37 @@
387387
(assert-at [11 3] "phasing wall (out of phase)"))
388388

389389

390+
(defn test-explosive-wall []
391+
(init [
392+
:map "
393+
@ X█o X█K X███X█
394+
X█X█X███X█X███X█
395+
T T T T T T T T"
396+
:map-marks {
397+
"T " ["thorn tree" :hp 100]
398+
"K " ["Dark Knight" :hp 100]}])
399+
(setv G.rules.reality-bubble-size 1)
400+
401+
; Hit one of the explosive walls, setting off a chain reaction
402+
; (which can extend past the reality bubble).
403+
(wk 'E)
404+
(assert-textmap
405+
:text "
406+
@ . . . K . ██X█
407+
. . . ██. . ██X█
408+
. . . . . . . T"
409+
:map-marks {
410+
"T " ["thorn tree" :hp 100]
411+
"K " ["Dark Knight" :hp (- 100 (* 4 3))]})
412+
; The player is unhurt.
413+
(assert (= G.player.hp 100))
414+
; And she gets points for harmed monsters, as normal.
415+
(assert (= G.score (+ 3 (* 10 7))))
416+
; Hitting an explosive wall takes a turn. In IQ, it doesn't, which
417+
; is presumably a bug.
418+
(assert (= G.turn-n 1)))
419+
420+
390421
(defn test-pushblock []
391422
(init
392423
[:tiles ["pushblock" "pile of gold"]])

0 commit comments

Comments
 (0)