@@ -11,8 +11,6 @@ import sc.plugin2021.util.GameRuleLogic
11
11
import sc.plugin2021.util.WinReason
12
12
import sc.protocol.responses.ProtocolMessage
13
13
import sc.shared.*
14
- import kotlin.math.log
15
-
16
14
17
15
@XStreamAlias(value = " game" )
18
16
class Game (UUID : String = GamePlugin .PLUGIN_UUID ): RoundBasedGameInstance<Player>() {
@@ -73,9 +71,9 @@ class Game(UUID: String = GamePlugin.PLUGIN_UUID): RoundBasedGameInstance<Player
73
71
it to gameState.getPointsForPlayer(it)
74
72
}.toMap()
75
73
76
- if (scoreMap[ Team .ONE ] !! > scoreMap[ Team .TWO ] !! )
74
+ if (scoreMap.getValue( Team .ONE ) > scoreMap.getValue( Team .TWO ) )
77
75
return WinCondition (Team .ONE , WinReason .DIFFERING_SCORES )
78
- if (scoreMap[ Team .TWO ] !! > scoreMap[ Team .ONE ] !! )
76
+ if (scoreMap.getValue( Team .TWO ) > scoreMap.getValue( Team .TWO ) )
79
77
return WinCondition (Team .TWO , WinReason .DIFFERING_SCORES )
80
78
return WinCondition (null , WinReason .EQUAL_SCORE )
81
79
}
@@ -99,7 +97,7 @@ class Game(UUID: String = GamePlugin.PLUGIN_UUID): RoundBasedGameInstance<Player
99
97
val winCondition = checkWinCondition()
100
98
101
99
var cause: ScoreCause = ScoreCause .REGULAR
102
- var reason: String = " "
100
+ var reason = " "
103
101
var score: Int = Constants .LOSE_SCORE
104
102
val points = gameState.getPointsForPlayer(team)
105
103
@@ -146,12 +144,9 @@ class Game(UUID: String = GamePlugin.PLUGIN_UUID): RoundBasedGameInstance<Player
146
144
147
145
@Throws(InvalidMoveException ::class , InvalidGameStateException ::class )
148
146
override fun onRoundBasedAction (fromPlayer : Player , data : ProtocolMessage ? ) {
149
- // This check is already done by super.onAction()
150
- assert (fromPlayer == activePlayer)
151
-
152
147
try {
153
148
if (data !is Move )
154
- throw InvalidMoveException (" ${fromPlayer.displayName} hat keinen validen Zug gesendet ." )
149
+ throw InvalidMoveException (" ${fromPlayer.displayName} did not send a proper move ." )
155
150
156
151
logger.debug(" Current State: $gameState " )
157
152
logger.debug(" Performing Move $data " )
0 commit comments