about summary refs log tree commit diff
path: root/src/Xanthous
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-10-06T17·13-0400
committerGriffin Smith <root@gws.fyi>2019-10-06T17·13-0400
commit6ab7cdfdc92dc337ec483f3a70ab38560b5aeb63 (patch)
treeae43c1234f3e5dce49afd4784b7616d2a5ad4130 /src/Xanthous
parenta57e36dca81274dea015c9fbdac680b44ef5576e (diff)
Only allow adjacent gormlaks to attack
Previously the isUnit function was falsely returning `True` for
positions that were one tile off in *either* direction from the
character, when it should've been *both*. Oops.
Diffstat (limited to 'src/Xanthous')
-rw-r--r--src/Xanthous/Data.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Xanthous/Data.hs b/src/Xanthous/Data.hs
index ff11a8da7f80..b7df191e58a8 100644
--- a/src/Xanthous/Data.hs
+++ b/src/Xanthous/Data.hs
@@ -136,7 +136,8 @@ diffPositions (Position x₁ y₁) (Position x₂ y₂) = Position (x₁ - x₂)
 --
 -- ∀ dir :: Direction. isUnit ('asPosition' dir)
 isUnit :: Position -> Bool
-isUnit (Position px py) = abs px == 1 || abs py == 1
+isUnit (Position px py) =
+  abs px `elem` [0,1] && abs py `elem` [0, 1] && (px, py) /= (0, 0)
 
 --------------------------------------------------------------------------------