diff --git a/CHANGELOG.md b/CHANGELOG.md index c3f1fbe00..e1842641f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,10 @@ The version should always be in sync with the [GUI](https://github.com/software- A `y` version of 0 marks the beta of the current year and likely contains breaking changes between patches. -### 24.2.X - 2023-10-XX -- Crash oversped ships +### 24.2.0 - 2023-10-XX +- Disqualify oversped ship - Allow other player to move on when one is disqualified +- Grey out winning ship so second player can follow ### 24.1.2 Stable Release - 2023-09-20 diff --git a/plugin/src/main/kotlin/sc/plugin2024/Action.kt b/plugin/src/main/kotlin/sc/plugin2024/Action.kt index 5ac5d187e..93865ab74 100644 --- a/plugin/src/main/kotlin/sc/plugin2024/Action.kt +++ b/plugin/src/main/kotlin/sc/plugin2024/Action.kt @@ -7,3 +7,7 @@ import sc.shared.IMoveMistake interface Action { fun perform(state: GameState): IMoveMistake? } + +interface Addable { + operator fun plus(other: T): T +} diff --git a/plugin/src/main/kotlin/sc/plugin2024/actions/Accelerate.kt b/plugin/src/main/kotlin/sc/plugin2024/actions/Accelerate.kt index f4270d7f2..da6454133 100644 --- a/plugin/src/main/kotlin/sc/plugin2024/actions/Accelerate.kt +++ b/plugin/src/main/kotlin/sc/plugin2024/actions/Accelerate.kt @@ -31,7 +31,7 @@ data class Accelerate( * Darf nicht 0 sein. */ @XStreamAsAttribute val acc: Int, -): Action { +): Action, Addable { /** * @@ -68,4 +68,6 @@ data class Accelerate( } override fun toString(): String = "Beschleunige um $acc" + + override fun plus(other: Accelerate): Accelerate = Accelerate(acc + other.acc) } diff --git a/plugin/src/main/kotlin/sc/plugin2024/actions/Advance.kt b/plugin/src/main/kotlin/sc/plugin2024/actions/Advance.kt index b27b4547e..c196c44e5 100644 --- a/plugin/src/main/kotlin/sc/plugin2024/actions/Advance.kt +++ b/plugin/src/main/kotlin/sc/plugin2024/actions/Advance.kt @@ -3,10 +3,7 @@ package sc.plugin2024.actions import com.thoughtworks.xstream.annotations.XStreamAlias import com.thoughtworks.xstream.annotations.XStreamAsAttribute import sc.api.plugins.CubeDirection -import sc.plugin2024.Action -import sc.plugin2024.Field -import sc.plugin2024.GameState -import sc.plugin2024.Ship +import sc.plugin2024.* import sc.plugin2024.mistake.AdvanceProblem import sc.plugin2024.util.PluginConstants import kotlin.math.absoluteValue @@ -30,7 +27,7 @@ import kotlin.math.absoluteValue data class Advance( /** Anzahl der Felder, die zurückgelegt werden. */ @XStreamAsAttribute val distance: Int, -): Action { +): Action, Addable { override fun perform(state: GameState): AdvanceProblem? { if(distance < PluginConstants.MIN_SPEED && @@ -51,5 +48,5 @@ data class Advance( override fun toString(): String = if(distance >= 0) "Gehe $distance Felder vor" else "Gehe $distance Felder zurück" - operator fun plus(other: Advance) = Advance(distance + other.distance) + override operator fun plus(other: Advance) = Advance(distance + other.distance) }