2 Commits

Author SHA1 Message Date
c5dd02a5e8 fix(base)!: Fixed gamelogic, but it breaks current UI - required more attention (CORE-2). (#56)
Reviewed-on: #56
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-11-26 11:27:58 +01:00
3048552f4c fix(base): COR-1 No Dog after vorletzte Runde (#55)
Reviewed-on: #55
Co-authored-by: Janis <janis.e.20@gmx.de>
Co-committed-by: Janis <janis.e.20@gmx.de>
2025-11-24 12:17:56 +01:00
2 changed files with 8 additions and 2 deletions

View File

@@ -69,6 +69,9 @@ final class BaseGameLogic(val config: Configuration) extends EventHandler with G
persistenceManager.update(ControlMatch) persistenceManager.update(ControlMatch)
if (state != InGame)
invoke(GameStateChangeEvent(state, InGame))
if (matchImpl.isOver) { if (matchImpl.isOver) {
//Winner is the last person in the playersIn list //Winner is the last person in the playersIn list
val winner = matchImpl.playersIn.head val winner = matchImpl.playersIn.head
@@ -199,7 +202,10 @@ final class BaseGameLogic(val config: Configuration) extends EventHandler with G
invoke(DelayEvent(2000)) invoke(DelayEvent(2000))
if (roundResult.notTricked.nonEmpty && !resultingRound.firstRound) { if (roundResult.notTricked.nonEmpty && !resultingRound.firstRound) {
if (matchImpl.dogLife) { // When the number of cards is less than 2, dog life ends automatically
val cantDogLife = (matchImpl.numberofcards - 1) < 2
if (matchImpl.dogLife && !cantDogLife) {
invoke(ShowPlayersOutEvent(roundResult.notTricked)) invoke(ShowPlayersOutEvent(roundResult.notTricked))
invoke(DelayEvent(2000)) invoke(DelayEvent(2000))
matchImpl = matchImpl.updatePlayersIn(matchImpl.playersIn.filterNot(roundResult.notTricked.contains(_))) matchImpl = matchImpl.updatePlayersIn(matchImpl.playersIn.filterNot(roundResult.notTricked.contains(_)))

View File

@@ -4,5 +4,5 @@ import de.knockoutwhist.control.GameState
import de.knockoutwhist.utils.events.SimpleEvent import de.knockoutwhist.utils.events.SimpleEvent
case class GameStateChangeEvent(oldState: GameState, newState: GameState) extends SimpleEvent { case class GameStateChangeEvent(oldState: GameState, newState: GameState) extends SimpleEvent {
override def id: String = s"GameStateChangeEvent(from=$oldState,to=$newState)" override def id: String = s"GameStateChangeEvent"
} }