From f2fd568a3209a25e034366a2b523d012a89a268f Mon Sep 17 00:00:00 2001 From: ninetailsrabbit Date: Sun, 16 Jun 2024 17:39:42 +0100 Subject: [PATCH] fixed a bug where diagonal non empty cells can be retrieved on pending fall moves --- Match3Maker/Match3Maker.csproj | 2 +- Match3Maker/src/components/Board.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Match3Maker/Match3Maker.csproj b/Match3Maker/Match3Maker.csproj index 28cc108..d90eaf2 100644 --- a/Match3Maker/Match3Maker.csproj +++ b/Match3Maker/Match3Maker.csproj @@ -14,7 +14,7 @@ Ninetailsrabbit.Match3Maker - 1.1.6 + 1.1.7 This lightweight library provides the core logic and functionality you need to build engaging match-3 games. Focus on game design and mechanics while leaving the complex logic to this library © 2024 Ninetailsrabbit Ninetailsrabbit diff --git a/Match3Maker/src/components/Board.cs b/Match3Maker/src/components/Board.cs index 6d56bf9..b4c031c 100644 --- a/Match3Maker/src/components/Board.cs +++ b/Match3Maker/src/components/Board.cs @@ -574,7 +574,8 @@ public List PendingFallMoves(IEnumerable? cells = null) { return cells.Where(cell => cell.HasPiece() && cell.Piece.Type.CanBeMoved() && cell.NeighbourBottom is not null) .Where(cell => (SelectedFillMode.Equals(FILL_MODES.FALL_DOWN) && cell.NeighbourBottom.IsEmpty()) || - (SelectedFillMode.Equals(FILL_MODES.SIDE_DOWN) && (cell.NeighbourBottom.IsEmpty() || cell.NeighbourBottom.HasPiece()) && (cell.DiagonalNeighbourBottomRight.IsEmpty() || cell.DiagonalNeighbourBottomLeft.IsEmpty())) + (SelectedFillMode.Equals(FILL_MODES.SIDE_DOWN) && (cell.NeighbourBottom.IsEmpty() || cell.NeighbourBottom.HasPiece()) + && (cell.DiagonalNeighbourBottomRight is not null && cell.DiagonalNeighbourBottomRight.IsEmpty() || cell.DiagonalNeighbourBottomLeft is not null && cell.DiagonalNeighbourBottomLeft.IsEmpty())) ) .ToList(); }