Skip to content

Commit f6c0597

Browse files
committed
Replaced burst's parameter exclude-center with include-center
1 parent 3c9a517 commit f6c0597

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

simalq/geometry.hy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
(break)))
211211
(tuple (cut out 1 None)))
212212

213-
(defn burst [center size [exclude-center False]]
213+
(defn burst [center size [include-center T]]
214214
"Return a generator of all distinct points within distance `size` of
215215
`center`. Thus the points form a square that's `2 * size + 1`
216216
squares wide. The order in which they're generated spirals outwards
@@ -227,7 +227,7 @@
227227
allows monsters closer to the player to move first, so a line of
228228
monsters can march toward the player without creating gaps.
229229
230-
If `exclude-center` is true, the center position isn't returned."
230+
If `include-center` is false, the center position isn't returned."
231231

232232
(unique (gfor
233233
c (thru 0 (min size (max center.map.width center.map.height)))
@@ -239,7 +239,7 @@
239239
:setv p (try
240240
(Pos center.map (+ center.x x) (+ center.y y))
241241
(except [GeometryError]))
242-
:if (and p (not (and exclude-center (= p center))))
242+
:if (and p (or (!= p center) include-center))
243243
p)))
244244

245245
(defn burst-size [size [article? True]]

simalq/tile/item.hy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
:targeted F
420420
:use (meth []
421421
"Creates a magical energy shield in each square adjacent to you. These shield tiles block monsters and their shots, but not you or your shots."
422-
(for [p (burst G.player.pos 1 :exclude-center T)]
422+
(for [p (burst G.player.pos 1 :include-center F)]
423423
(Tile.make p "magical energy shield")))
424424
425425
:flavor "Cowardice is the better part of valor.")

simalq/tile/monster.hy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@
11201120
'bats
11211121
(@summon "bat" @summon-frequency @summon-hp)
11221122
'vampirize
1123-
(block (for [p (burst @pos 1 :exclude-center T) tile (at p)]
1123+
(block (for [p (burst @pos 1 :include-center F) tile (at p)]
11241124
(when (and
11251125
(isinstance tile Monster)
11261126
tile.vampirizable

simalq/tile/scenery.hy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@
774774
; positions.
775775
(setv candidate-dist Inf)
776776
(setv candidates [])
777-
(for [p (burst G.player.pos G.rules.reality-bubble-size :exclude-center T)]
777+
(for [p (burst G.player.pos G.rules.reality-bubble-size :include-center F)]
778778
(when (> (dist p @pos) candidate-dist)
779779
; When multiple teleporters are in range, we consider only
780780
; the subset that's as close as possible.
@@ -784,7 +784,7 @@
784784
; This position can be a candidate if it has at least one
785785
; free adjacent position.
786786
(when (setx neighbors (tuple (gfor
787-
n-p (burst p 1 :exclude-center T)
787+
n-p (burst p 1 :include-center F)
788788
:if (all (gfor
789789
n-tile (at n-p)
790790
(isinstance n-tile Monster)))

tests/test_geometry.hy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,18 +254,18 @@
254254

255255

256256
(defn test-burst []
257-
(for [size [2 6] exclude-center [F T] wrap-x [F T] wrap-y [F T]]
257+
(for [size [2 6] include-center [F T] wrap-x [F T] wrap-y [F T]]
258258
(setv m (Map.make :!wrap-x :!wrap-y :width 5 :height 7))
259259
(setv p0 (Pos m 1 1))
260-
(setv b (tuple (burst p0 size exclude-center)))
260+
(setv b (tuple (burst p0 size include-center)))
261261
; A burst shouldn't duplicate positions.
262262
(assert (= (len b) (len (set b))))
263263
; A point should be in a burst if and only if it's close enough to
264264
; the center.
265265
(for [x (range m.width) y (range m.height)]
266266
(setv p (Pos m x y))
267267
(assert (=
268-
(if (= p p0) (not exclude-center) (<= (dist p p0) size))
268+
(if (= p p0) include-center (<= (dist p p0) size))
269269
(in p b))))))
270270

271271

tests/test_monster.hy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@
536536
f"a thorn-tree generator (HP 3, pw 0, freq 1, sHP {shp})")
537537
; Check that the generator produces a ring of trees.
538538
(wait 9)
539-
(for [p (burst (Pos G.map 3 2) 1 :exclude-center T)]
539+
(for [p (burst (Pos G.map 3 2) 1 :include-center F)]
540540
(assert-at p "thorn tree")
541541
(assert-hp p shp)))
542542

0 commit comments

Comments
 (0)