Skip to content

Commit 5266a25

Browse files
committed
fix(plugin24): do not allow omitting movement checks
Can be more reliably enforced by raising movement points temporarily
1 parent ea50632 commit 5266a25

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

plugin/src/main/kotlin/sc/plugin2024/Action.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ import sc.shared.IMoveMistake
55

66
@XStreamAlias(value = "action")
77
interface Action {
8-
fun perform(state: GameState, movementCheck: Boolean = true): IMoveMistake?
8+
fun perform(state: GameState): IMoveMistake?
99
}

plugin/src/main/kotlin/sc/plugin2024/actions/Accelerate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ data class Accelerate(
3838
* @param state [GameState], auf dem die Beschleunigung ausgeführt wird
3939
* @param ship [Ship], für welches die Beschleunigung ausgeführt wird
4040
*/
41-
override fun perform(state: GameState, movementCheck: Boolean): AccelerationProblem? {
41+
override fun perform(state: GameState): AccelerationProblem? {
4242
var speed: Int = state.currentShip.speed
4343
speed += acc
4444
when {

plugin/src/main/kotlin/sc/plugin2024/actions/Advance.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ data class Advance(
3131
@XStreamAsAttribute val distance: Int,
3232
): Action {
3333

34-
override fun perform(state: GameState, movementCheck: Boolean): AdvanceProblem? {
34+
override fun perform(state: GameState): AdvanceProblem? {
3535
if(distance < 1 && state.board[state.currentShip.position] != Field.SANDBANK || distance > 6)
3636
return AdvanceProblem.INVALID_DISTANCE
3737

3838
val result = state.checkAdvanceLimit(state.currentShip.position, if(distance > 0) state.currentShip.direction else state.currentShip.direction.opposite(), state.currentShip.movement)
39-
if(result.distance < distance.absoluteValue && movementCheck)
39+
if(result.distance < distance.absoluteValue)
4040
return result.problem
4141

4242
state.currentShip.position += state.currentShip.direction.vector * distance

plugin/src/main/kotlin/sc/plugin2024/actions/Push.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ data class Push(
3333
@XStreamAsAttribute val direction: CubeDirection,
3434
): Action {
3535

36-
override fun perform(state: GameState, movementCheck: Boolean): PushProblem? {
36+
override fun perform(state: GameState): PushProblem? {
3737
val nudgedShip = state.otherShip
3838

39-
if(state.currentShip.movement == 0 && movementCheck)
39+
if(state.currentShip.movement == 0)
4040
return PushProblem.MOVEMENT_POINTS_MISSING
4141
state.currentShip.movement--
4242

plugin/src/main/kotlin/sc/plugin2024/actions/Turn.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data class Turn(
2727
@XStreamAsAttribute val direction: CubeDirection,
2828
): Action {
2929

30-
override fun perform(state: GameState, movementCheck: Boolean): TurnProblem? {
30+
override fun perform(state: GameState): TurnProblem? {
3131
val turnCount = state.currentShip.direction.turnCountTo(direction)
3232

3333
val absTurnCount = turnCount.absoluteValue

0 commit comments

Comments
 (0)