Bugfix: identifyCardinalDirection reported directions backwards

Which happened to cancel out that potentialCoverDirections fed in its arguments
backwards
This commit is contained in:
Emi Simpson 2023-12-05 15:14:43 -05:00
parent 36aba598e8
commit f3db53120c
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -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]]