Zomis / Games

Many kinds of games, playable in both multiplayer or local play. Replays, spectator mode, and AIs.
https://games.zomis.net
MIT License
17 stars 5 forks source link

Set does not automatically remove cards #257

Closed Zomis closed 3 years ago

Zomis commented 3 years ago

When playing Set, at least with the try-mode, it does not automatically clear cards, until you click on the "reset" button.

Zomis commented 3 years ago

The problem seems to be that the client is sending a view request with chosens filled in.

I believe that when a "GameMove" is received, the client should clear the chosen if the playerIndex matches.

[2021-07-03 11:01:57,609] ERROR net.zomis.core.events.ListenerList [qtp249034932-16] - Problem when handling event ClientJsonMessage(client=net.zomis.games.server2.ws.WebClient:(b4c6bb4b-3430-4384-9670-3b6e80f7ee17/Zomis), data={"route":"games/Set/6fefba57-878c-4f2e-8a12-183ade7d5a43/view","playerIndex":"0","actionType":"set","chosen":["1-squiggly-striped-green","2-ellipse-filled-green","3-diamond-clear-green"]}) in net.zomis.core.events.Listener@24f64e21
java.util.NoSuchElementException: Evaluated contains [(3-ellipse-striped-red, 3-ellipse-striped-red), (3-ellipse-filled-red, 3-ellipse-filled-red), (1-squiggly-filled-red, 1-squiggly-filled-red), (1-ellipse-clear-purple, 1-ellipse-clear-purple), (1-ellipse-striped-purple, 1-ellipse-striped-purple), (2-squiggly-clear-green, 2-squiggly-clear-green), (1-diamond-clear-purple, 1-diamond-clear-purple), (3-diamond-clear-purple, 3-diamond-clear-purple), (3-ellipse-clear-green, 3-ellipse-clear-green), (2-squiggly-clear-red, 2-squiggly-clear-red), (3-diamond-striped-red, 3-diamond-striped-red), (2-diamond-striped-red, 2-diamond-striped-red)] and we're looking for it.first == 1-squiggly-striped-green (class kotlin.String)
    at net.zomis.games.dsl.impl.ActionComplexBlockRun.internalOptions(ActionComplexImpl.kt:67)
    at net.zomis.games.dsl.impl.ActionComplexBlockRun.options(ActionComplexImpl.kt:78)
    at net.zomis.games.impl.SetGame$game$1$2$1$1.invoke(SetGame.kt:206)
    at net.zomis.games.impl.SetGame$game$1$2$1$1.invoke(SetGame.kt:150)
    at net.zomis.games.dsl.impl.ActionComplexImpl.withChosen(ActionComplexImpl.kt:38)
    at net.zomis.games.dsl.impl.GameActionRuleContext.actionInfoKeys(RulesImpl.kt:271)
    at net.zomis.games.dsl.impl.ActionTypeImplEntry.actionInfoKeys(ActionsImpl.kt:93)
    at net.zomis.games.server2.games.JsonChoices.availableActionsMessage(JsonChoices.kt:16)
    at net.zomis.games.server2.games.JsonChoices.deserialize(JsonChoices.kt:30)
    at net.zomis.games.server2.games.ServerGame.view(GameSystem.kt:146)
    at net.zomis.games.server2.games.ServerGame.access$view(GameSystem.kt:51)
    at net.zomis.games.server2.games.ServerGame$router$1.invoke(GameSystem.kt:56)
    at net.zomis.games.server2.games.ServerGame$router$1.invoke(GameSystem.kt:51)
    at net.zomis.games.server2.MessageRouter.handle(MessageRouter.kt:41)
    at net.zomis.games.server2.MessageRouter.handle(MessageRouter.kt:38)
Zomis commented 3 years ago

Fixed in commit 80c7c832be98e7b21346d4ba28ca3cfce1974e75. The problem was that the state was being overwritten with a string value instead of an integer, so the check if (data.player === gameInfo.activeIndex) returned false.