From f3db53120c9f38b186d494d0dbbfa1d1aef1362f Mon Sep 17 00:00:00 2001 From: Emi Simpson Date: Tue, 5 Dec 2023 15:14:43 -0500 Subject: [PATCH] Bugfix: identifyCardinalDirection reported directions backwards Which happened to cancel out that potentialCoverDirections fed in its arguments backwards --- src/GameLogic.hs | 2 +- src/GameModel.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GameLogic.hs b/src/GameLogic.hs index d738b31..3666c36 100644 --- a/src/GameLogic.hs +++ b/src/GameLogic.hs @@ -171,7 +171,7 @@ applyEffect (ResolveAttack attacker attack defender) board = Roll actualDiceRoll attackerPosition = unitPosition board attacker defenderPosition = unitPosition board defender potentialCoverDirections = - usingBoardDimensions board identifyCardinalDirection <$> attackerPosition <*> defenderPosition + usingBoardDimensions board identifyCardinalDirection <$> defenderPosition <*> attackerPosition potentialCoverLocations = fromMaybe [] $ (mapMaybe . offsetB board <$> defenderPosition) <*> potentialCoverDirections diff --git a/src/GameModel.hs b/src/GameModel.hs index 38b9061..242b26b 100644 --- a/src/GameModel.hs +++ b/src/GameModel.hs @@ -303,12 +303,12 @@ identifyCardinalDirection w _ from to = northOrSouth ++ eastOrWest (fromX, fromY) = coordinates w from (toX, toY) = coordinates w to northOrSouth - | fromY > toY = [South] - | fromY < toY = [North] + | fromY < toY = [South] + | fromY > toY = [North] | otherwise = [ ] eastOrWest - | fromX > toX = [East] - | fromX < toX = [West] + | fromX < toX = [East] + | fromX > toX = [West] | otherwise = [ ] cardinalDirections :: [[OrthagonalDirection]]