Compare commits
2 Commits
ec94ecd46c
...
c5dd02a5e8
| Author | SHA1 | Date | |
|---|---|---|---|
| c5dd02a5e8 | |||
| 3048552f4c |
@@ -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(_)))
|
||||||
|
|||||||
@@ -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"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user