File tree 2 files changed +5
-2
lines changed
shared/sc/plugin2020/util
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ object GameRuleLogic {
88
88
}
89
89
90
90
private fun validateSkipMove (gameState : GameState ): Boolean {
91
- if (this .getPossibleMoves(gameState).isNotEmpty() )
91
+ if (this .getPossibleMoves(gameState).any { it !is SkipMove } )
92
92
throw InvalidMoveException (" Skipping a turn is only allowed when no other moves can be made." )
93
93
if (gameState.round == 3 && ! hasPlayerPlacedBee(gameState))
94
94
throw InvalidMoveException (" The bee must be placed in fourth round latest" )
@@ -337,7 +337,9 @@ object GameRuleLogic {
337
337
338
338
@JvmStatic
339
339
fun getPossibleMoves (gameState : GameState ): List <Move > =
340
- this .getPossibleSetMoves(gameState) + this .getPossibleDragMoves(gameState)
340
+ (this .getPossibleSetMoves(gameState) + this .getPossibleDragMoves(gameState)).ifEmpty {
341
+ listOf (SkipMove )
342
+ }
341
343
342
344
@JvmStatic
343
345
fun getPossibleDragMoves (gameState : GameState ): List <Move > =
Original file line number Diff line number Diff line change @@ -1261,6 +1261,7 @@ class GamePlayTest {
1261
1261
" ------------" )
1262
1262
val valid = SkipMove
1263
1263
assertTrue(GameRuleLogic .validateMove(state, valid))
1264
+ assertEquals(GameRuleLogic .getPossibleMoves(state), listOf (SkipMove ))
1264
1265
}
1265
1266
}
1266
1267
You can’t perform that action at this time.
0 commit comments