You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugin2026/src/main/kotlin/sc/plugin2026/util/GameRuleLogic.kt
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ import sc.plugin2026.Field
7
7
importsc.plugin2026.FieldState
8
8
importsc.plugin2026.Move
9
9
importsc.shared.InvalidMoveException
10
+
importsc.shared.MoveMistake
10
11
11
12
classGameRuleLogic private constructor() {
12
13
init {
@@ -45,13 +46,13 @@ class GameRuleLogic private constructor() {
45
46
46
47
@Throws(InvalidMoveException::class)
47
48
funisValidToMove(
48
-
state: sc.plugin2019.GameState,
49
+
state: sc.plugin2026.GameState,
49
50
x:Int,
50
51
y:Int,
51
52
direction:Direction,
52
53
distance:Int
53
54
): Boolean {
54
-
if(x >=PiranhaConstants.BOARD_LENGTH|| y >=PiranhaConstants.BOARD_LENGTH|| x <0|| y <0) throwInvalidMoveException("x or y are not within the field range")
55
+
if(x >=PiranhaConstants.BOARD_LENGTH|| y >=PiranhaConstants.BOARD_LENGTH|| x <0|| y <0) throwInvalidMoveException(MoveMistake.OUT_OF_BOUNDS)
55
56
val board = state.board
56
57
val curField:Field= board.getField(x, y)
57
58
val curFieldPlayer: java.util.Optional<Team> = curField.piranha
@@ -66,13 +67,13 @@ class GameRuleLogic private constructor() {
66
67
y,
67
68
direction
68
69
) != distance
69
-
) throwInvalidMoveException("Move distance was incorrect")
0 commit comments