Skip to content

Commit 51d25dd

Browse files
committed
Cleaned up rule assignments in tests.
1 parent c03c18b commit 51d25dd

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

tests/test_basic.hy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161

6262
(defn test-shoot []
6363
(init
64+
:reality-bubble-size 4
6465
:tiles ['floor 'floor 'floor 'floor ["orc" :hp 2]])
65-
(setv G.rules.reality-bubble-size 4)
6666

6767
(assert (= G.turn-n 0))
6868
(shoot 'E)

tests/test_item.hy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,10 @@
580580

581581
(defn test-wand-webs []
582582
(init
583+
:reality-bubble-size 7
583584
:height 1
584585
:tiles ['floor "pile of gold" 'floor "wall" "giant spider" "wall" 'floor 'floor])
585586

586-
(setv G.rules.reality-bubble-size 7)
587587
(use-item "wand of webs")
588588
; Every free square in the reality bubble gets a web.
589589
; (The wand doesn't add a web under the spider, but the spider makes
@@ -684,6 +684,7 @@
684684

685685
(defn test-wand-remote-action []
686686
(init
687+
:reality-bubble-size Inf
687688
:width 30 :height 1
688689
:tiles [
689690
"pile of gold" "wall generator (west)"
@@ -693,7 +694,6 @@
693694
"cracked wall" "orc"])
694695
(defn remote [x]
695696
(use-item "wand of remote action" [x 0]))
696-
(setv G.rules.reality-bubble-size 20)
697697
(setv nothing "There isn't anything you can affect there.")
698698

699699
; Wands of remote action can do lots of things.

tests/test_monster.hy

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,9 @@
156156
(defn test-nondainty []
157157
(for [dainty [F T]]
158158
(init
159+
:dainty-monsters dainty
159160
:height 1
160161
:tiles ["pile of gold" "orc" "wall" "orc" "orc"])
161-
(when (not dainty)
162-
(setv G.rules.dainty-monsters F))
163162

164163
(if dainty
165164
; By default, normal monsters will only step on plain floor.
@@ -253,12 +252,12 @@
253252

254253
(defn test-generator-reality-bubble []
255254
(init
255+
:reality-bubble-size 4
256256
:height 1
257257
:tiles [
258258
'floor 'floor "wall" 'floor
259259
["generator" :summon-class "orc" :summon-frequency (f/ 1)]
260260
'floor])
261-
(setv G.rules.reality-bubble-size 4)
262261

263262
; Outside the reality bubble, generators do nothing.
264263
(wait 10)
@@ -278,6 +277,7 @@
278277
; monster (`gen-west T`) and farther (`gen-west F`).
279278

280279
(init
280+
:dainty-monsters F
281281
:map "
282282
. . $ $
283283
@ . a b
@@ -287,7 +287,6 @@
287287
:summon-class "orc"
288288
:summon-frequency (f/ 1 4)]
289289
(if gen-west "b " "a ") 'floor})
290-
(setv G.rules.dainty-monsters F)
291290

292291
(defn check [orc-at-p1 orc-at-p2]
293292
(setv p1 (if gen-west (Pos G.map 3 1) (Pos G.map 2 1)))
@@ -336,12 +335,13 @@
336335
; A wandering bat will eventually cover the reality bubble, if
337336
; it can't attack the player. It can't leave the reality bubble
338337
; on its own.
339-
(init :map "
340-
. . . . .
341-
. . b . .
342-
██. . . .
343-
@ ██. . .")
344-
(setv G.rules.reality-bubble-size 3)
338+
(init
339+
:reality-bubble-size 3
340+
:map "
341+
. . . . .
342+
. . b . .
343+
██. . . .
344+
@ ██. . .")
345345
(assert (= G.player.hp 100))
346346
(setv seen-at (dfor
347347
x (range G.map.width)
@@ -884,8 +884,8 @@
884884

885885
(defn test-siren []
886886
(init
887+
:reality-bubble-size Inf
887888
:tiles (+ (* ['floor] 10) ["siren"]))
888-
(setv G.rules.reality-bubble-size 20)
889889

890890
; The siren needs to build up shot power before it can paralyze.
891891
(assert-at [11 0] "siren")
@@ -954,14 +954,14 @@
954954
(defn test-umber-hulk []
955955

956956
(init
957+
:reality-bubble-size Inf
957958
:map "
958959
@ ▒▒| ##U █1^█++██◀▶██"
959960
:map-marks {
960961
"▒▒" "Void"
961962
"##" "cracked wall"
962963
"█1" "trapped wall"
963964
"++" "door"})
964-
(setv G.rules.reality-bubble-size 20)
965965

966966
; Umber hulks can destroy somewhat more tiles than IQ's kroggs. Not
967967
; everything, though.
@@ -1092,9 +1092,10 @@
10921092
(fn [self state] #(Direction.E state)))
10931093

10941094
; Upon wandering onto an item, a snitch will pick it up.
1095-
(init :map "
1096-
@ . . . . n $ . . . . . . .")
1097-
(setv G.rules.reality-bubble-size 20)
1095+
(init
1096+
:reality-bubble-size Inf
1097+
:map "
1098+
@ . . . . n $ . . . . . . .")
10981099
(wait 1)
10991100
(assert-at [6 0] "snitch")
11001101
; The snitch holds the item for 5 turns before losing interest.
@@ -1108,11 +1109,11 @@
11081109
; When a snitch holding an item picks up a new one, it drops the old
11091110
; one on its previous square.
11101111
(init
1112+
:reality-bubble-size Inf
11111113
:map "
11121114
@ . . . . n / . $ . . ."
11131115
:map-marks {
11141116
"/ " "wand of nothing"})
1115-
(setv G.rules.reality-bubble-size 20)
11161117
(wait 3)
11171118
(assert-at [7 0] "wand of nothing")
11181119
(assert-at [8 0] "snitch")

tests/test_scenery.hy

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@
279279
"| " "breakable wall (meridional)"
280280
"- " "breakable wall (zonal)"})
281281
(init
282+
:reality-bubble-size 2
283+
; Destruction propogates outside the reality bubble.
282284
:map "
283285
. | | | .
284286
. | | | .
285287
. | | | .
286288
@ - - | -"
287289
:map-marks marks)
288-
(setv G.rules.reality-bubble-size 2)
289-
; Destruction propogates outside the reality bubble.
290290

291291
(wk 'E)
292292
(assert-textmap :map-marks marks :text "
@@ -352,12 +352,12 @@
352352
"o " "phasing wall (out of phase)"
353353
"| " "phase trigger"})
354354
(init
355+
:reality-bubble-size 1
356+
; Phasing occurs across the whole level.
355357
:map "
356358
X X X | X X o
357359
o X o @ X o o "
358360
:map-marks marks)
359-
(setv G.rules.reality-bubble-size 1)
360-
; Phasing occurs across the whole level.
361361

362362
; Phase triggers can be triggered by sword or by arrow.
363363
(wk 'N)
@@ -389,14 +389,14 @@
389389

390390
(defn test-explosive-wall []
391391
(init
392+
:reality-bubble-size 1
392393
:map "
393394
@ X█o X█K X███X█
394395
X█X█X███X█X███X█
395396
T T T T T T T T"
396397
:map-marks {
397398
"T " ["thorn tree" :hp 100]
398399
"K " ["Dark Knight" :hp 100]})
399-
(setv G.rules.reality-bubble-size 1)
400400

401401
; Hit one of the explosive walls, setting off a chain reaction
402402
; (which can extend past the reality bubble).
@@ -448,10 +448,10 @@
448448

449449
(defn test-wall-generator []
450450
(init
451+
:reality-bubble-size 2
451452
:map "
452453
. →|. . o . . .
453454
@ →|. . . . . .")
454-
(setv G.rules.reality-bubble-size 2)
455455

456456
; Wall generators aren't limited by the reality bubble.
457457
(wk 'E)
@@ -573,9 +573,9 @@
573573
; target square need not be.
574574
(for [size [2 3]]
575575
(init
576+
:reality-bubble-size size
576577
:height 1
577578
:tiles ["teleporter" "wall" "wall" "teleporter"])
578-
(setv G.rules.reality-bubble-size size)
579579
(wk 'E)
580580
(assert-player-at (if (= size 2) 1 5) 0))
581581

@@ -656,6 +656,8 @@
656656

657657
(defn test-wallfall-trap []
658658
(init
659+
:reality-bubble-size 0
660+
; Wallfall traps are unaffected by the reality bubble.
659661
:map "
660662
@ t1t0t2
661663
. t1t0t2
@@ -670,9 +672,6 @@
670672
(assert-full-name 'E "a wallfall trap (type 1)")
671673
(assert-full-name [3 0] "a trapped wall (type 2)")
672674

673-
(setv G.rules.reality-bubble-size 0)
674-
; Wallfall traps are unaffected by the reality bubble.
675-
676675
(defn check [text]
677676
(assert-textmap text {
678677
"t " "wallfall trap"

0 commit comments

Comments
 (0)