@@ -69,8 +69,8 @@ data class GameState @JvmOverloads constructor(
69
69
fun calculatePoints (ship : Ship ) =
70
70
board.segmentIndex(ship.position).let { segmentIndex ->
71
71
segmentIndex * POINTS_PER_SEGMENT +
72
- board.segments[segmentIndex].globalToLocal(ship.position).arrayX + 1
73
- // TODO points per passenger
72
+ board.segments[segmentIndex].globalToLocal(ship.position).arrayX + 1 +
73
+ ship.passengers * PluginConstants . POINTS_PER_PASSENGER
74
74
}
75
75
76
76
/* *
@@ -101,9 +101,9 @@ data class GameState @JvmOverloads constructor(
101
101
board.pickupPassenger(currentShip)
102
102
currentShip.points = calculatePoints(currentShip)
103
103
if (move.actions.any { it is Push }) {
104
- otherShip.points = calculatePoints(otherShip)
105
104
if (otherShip.speed == 1 )
106
105
board.pickupPassenger(otherShip)
106
+ otherShip.points = calculatePoints(otherShip)
107
107
}
108
108
109
109
lastMove = move
@@ -317,7 +317,7 @@ data class GameState @JvmOverloads constructor(
317
317
override val isOver: Boolean
318
318
get() = when {
319
319
// Bedingung 1: ein Dampfer mit 2 Passagieren erreicht ein Zielfeld mit Geschwindigkeit 1
320
- turn % 2 == 0 && ships.any { it.passengers == 2 && board.effectiveSpeed (it) < 2 && board[it.position] == Field . GOAL } -> true
320
+ turn % 2 == 0 && ships.any { isWinner (it) } -> true
321
321
// Bedingung 2: ein Spieler macht einen ungültigen Zug.
322
322
// Das wird durch eine InvalidMoveException während des Spiels behandelt.
323
323
// Bedingung 3: am Ende einer Runde liegt ein Dampfer mehr als 3 Spielsegmente zurück
@@ -328,9 +328,12 @@ data class GameState @JvmOverloads constructor(
328
328
else -> false
329
329
}
330
330
331
+ fun isWinner (ship : Ship ) =
332
+ ship.passengers == 2 && board.effectiveSpeed(ship) < 2 && board[ship.position] == Field .GOAL
333
+
331
334
override fun getPointsForTeam (team : ITeam ): IntArray =
332
335
ships[team.index].let { ship ->
333
- intArrayOf(ship.points, ship.coal * 2 )
336
+ intArrayOf(ship.points, ship.coal * 2 , if (isWinner(ship)) 6 else 0 )
334
337
}
335
338
336
339
override fun clone (): GameState = copy(board = board.clone(), ships = ships.clone())
0 commit comments