Skip to content

Commit a540c7d

Browse files
committed
Simplified the Boolean logic for approach-dir.
1 parent 3566513 commit a540c7d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

simalq/tile/monster.hy

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
re
1111
fractions [Fraction :as f/]
1212
enum [Enum]
13-
hyrule [thru]
13+
hyrule [thru xor]
1414
toolz [unique]
1515
simalq.util [DamageType StatusEffect next-in-cycle mixed-number]
1616
simalq.geometry [Direction at dist adjacent? adj-or-eq? dir-to turn-and-pos-seed ray]
@@ -241,12 +241,9 @@
241241
(next-in-cycle Direction.orths @approach-dir))
242242
(when advance-approach-dir
243243
(setv @approach-dir approach-dir))
244-
(setv d (tuple (gfor c ["x" "y"]
245-
(if (getattr approach-dir c)
246-
(if (getattr d c)
247-
0
248-
(getattr approach-dir c))
249-
(getattr d c)))))
244+
(setv d (tuple (gfor
245+
c ["x" "y"]
246+
(int (xor (getattr approach-dir c) (getattr d c))))))
250247
; Per IQ, we make only one attempt to find a new direction.
251248
; So if this fails, give up.
252249
(when (= d #(0 0))

0 commit comments

Comments
 (0)