diff --git a/src/main/java/Game/ChessObj/ChessFigure.java b/src/main/java/Game/ChessObj/ChessFigure.java index 0b06f00..029b233 100644 --- a/src/main/java/Game/ChessObj/ChessFigure.java +++ b/src/main/java/Game/ChessObj/ChessFigure.java @@ -78,7 +78,7 @@ public class ChessFigure { return true; break; case BISHOP: - if (dx == dy) + if (Math.abs(dx) == Math.abs(dy)) return true; break; case KNIGHT: diff --git a/src/test/java/Game/ChessObj/ChessFigureTest.java b/src/test/java/Game/ChessObj/ChessFigureTest.java index 1542ef4..2232596 100644 --- a/src/test/java/Game/ChessObj/ChessFigureTest.java +++ b/src/test/java/Game/ChessObj/ChessFigureTest.java @@ -80,7 +80,7 @@ class ChessFigureTest { } break; case BISHOP: - if (x == y) { + if (Math.abs(x) == Math.abs(y)) { assertTrue(figure.isRelativeMoveValid(x, y)); continue; }