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 attackerPosition = unitPosition board attacker
defenderPosition = unitPosition board defender defenderPosition = unitPosition board defender
potentialCoverDirections = potentialCoverDirections =
usingBoardDimensions board identifyCardinalDirection <$> attackerPosition <*> defenderPosition usingBoardDimensions board identifyCardinalDirection <$> defenderPosition <*> attackerPosition
potentialCoverLocations = potentialCoverLocations =
fromMaybe [] $ fromMaybe [] $
(mapMaybe . offsetB board <$> defenderPosition) <*> potentialCoverDirections (mapMaybe . offsetB board <$> defenderPosition) <*> potentialCoverDirections

View File

@ -303,12 +303,12 @@ identifyCardinalDirection w _ from to = northOrSouth ++ eastOrWest
(fromX, fromY) = coordinates w from (fromX, fromY) = coordinates w from
(toX, toY) = coordinates w to (toX, toY) = coordinates w to
northOrSouth northOrSouth
| fromY > toY = [South] | fromY < toY = [South]
| fromY < toY = [North] | fromY > toY = [North]
| otherwise = [ ] | otherwise = [ ]
eastOrWest eastOrWest
| fromX > toX = [East] | fromX < toX = [East]
| fromX < toX = [West] | fromX > toX = [West]
| otherwise = [ ] | otherwise = [ ]
cardinalDirections :: [[OrthagonalDirection]] cardinalDirections :: [[OrthagonalDirection]]