Skip to content

Commit

Permalink
Implemented phase wands.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodiologist committed Jan 23, 2024
1 parent 8519569 commit 28b419a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
14 changes: 14 additions & 0 deletions simalq/tile/item.hy
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,20 @@
:flavor "This device is detested by the stonemason's union, but valued by homeowners and combat engineers, not to mention tyrants who desire vast dungeons.")
(deftile "/ " "a phase wand" Usable
:color 'brown
:iq-ix 143
:acquirement-points 50
:use (meth [target]
"If there's at least one phasing wall on the target square, then the topmost one is phase-shifted. Otherwise, a new out-of-phase wall is created."
(for [t (at target) :if (isinstance t hy.I.simalq/tile/scenery.Phaser)]
(.phase-shift t)
(return))
(Tile.make target "phasing wall (out of phase)"))
:flavor "This attempt to create a portable phase trigger didn't entirely succeed.")
(deftile "/ " "a passwall wand" Usable
:color 'dark-green
:iq-ix 32
Expand Down
7 changes: 5 additions & 2 deletions simalq/tile/scenery.hy
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,11 @@
(setv map-attr "phasers")
(setv phase-replace None)

(defmeth poshooked-callback []
(@replace @phase-replace)))
(defmeth phase-shift []
(@replace @phase-replace))

(setv poshooked-callback phase-shift))


(deftile "☯█" "a phasing wall (in phase)" Phaser
:color #('white None)
Expand Down
1 change: 0 additions & 1 deletion simalq/tile/unimplemented.hy
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
[132 "golem"]
[134 "siren"]
[141 "phasing_wall_trap"]
[143 "phase_wand"]
[151 "passwall_amulet"]
[152 "random_gate"]
[154 "wand_of_flame"]
Expand Down
25 changes: 25 additions & 0 deletions tests/test_item.hy
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,31 @@
(assert-at [3 0] "wall"))


(defn test-wand-phase []
(init [])
(defn phase [start end]
(set-square 'E #* start)
(use-item "phase wand" 1 0)
(assert-at 'E #* end))

(phase
[]
["phasing wall (out of phase)"])
(phase
["wall"]
["phasing wall (out of phase)" "wall"])
(phase
["phasing wall (out of phase)"]
["phasing wall (in phase)"])
(phase
["phasing wall (in phase)"]
["phasing wall (out of phase)"])
; Only the topmost phaser is affected.
(phase
["wall" "phasing wall (in phase)" "wall" "phasing wall (out of phase)"]
["wall" "phasing wall (out of phase)" "wall" "phasing wall (out of phase)"]))


(defn test-wand-passwall []
(init
[:tiles ["orc" "wall" "pillar"]])
Expand Down

0 comments on commit 28b419a

Please sign in to comment.