changes to sync
parent
7b7b5a902d
commit
62c9ec2d28
@ -0,0 +1,4 @@
|
||||
package eu.jonahbauer.wizard.core.machine.states;
|
||||
|
||||
public interface TransientState {
|
||||
}
|
@ -1,17 +1,19 @@
|
||||
package eu.jonahbauer.wizard.core.machine.states.round;
|
||||
|
||||
import eu.jonahbauer.wizard.core.machine.Game;
|
||||
import eu.jonahbauer.wizard.core.machine.GameState;
|
||||
import eu.jonahbauer.wizard.core.machine.states.GameData;
|
||||
import eu.jonahbauer.wizard.core.machine.states.SyncState;
|
||||
|
||||
public final class StartingRound extends SyncState {
|
||||
import java.util.Optional;
|
||||
|
||||
public final class StartingRound extends RoundState {
|
||||
|
||||
public StartingRound(GameData data) {
|
||||
super(RoundState.requirements(data));
|
||||
super(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GameState getNextState() {
|
||||
return new Dealing(getData());
|
||||
public Optional<GameState> onEnter(Game context) {
|
||||
return sync(Dealing::new);
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package eu.jonahbauer.wizard.core.machine.states.round;
|
||||
|
||||
import eu.jonahbauer.wizard.core.machine.GameState;
|
||||
import eu.jonahbauer.wizard.core.machine.states.GameData;
|
||||
import eu.jonahbauer.wizard.core.machine.states.SyncState;
|
||||
|
||||
import static eu.jonahbauer.wizard.core.machine.states.GameData.*;
|
||||
|
||||
public final class TrumpDetermined extends SyncState {
|
||||
|
||||
public TrumpDetermined(GameData data) {
|
||||
super(RoundState.requirements(data).requireEach(PLAYERS, HANDS).require(PREDICTIONS, TRUMP_SUIT, CURRENT_PLAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GameState getNextState() {
|
||||
return new Predicting(getData());
|
||||
}
|
||||
}
|
@ -1,18 +1,21 @@
|
||||
package eu.jonahbauer.wizard.core.machine.states.trick;
|
||||
|
||||
import eu.jonahbauer.wizard.core.machine.Game;
|
||||
import eu.jonahbauer.wizard.core.machine.GameState;
|
||||
import eu.jonahbauer.wizard.core.machine.states.GameData;
|
||||
import eu.jonahbauer.wizard.core.machine.states.SyncState;
|
||||
import eu.jonahbauer.wizard.core.machine.states.round.RoundState;
|
||||
|
||||
public final class StartingTrick extends SyncState {
|
||||
import java.util.Optional;
|
||||
|
||||
public final class StartingTrick extends TrickState {
|
||||
|
||||
public StartingTrick(GameData data) {
|
||||
super(RoundState.requirements(TrickState.requirements(data)));
|
||||
super(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GameState getNextState() {
|
||||
return new PlayingCard(getData());
|
||||
public Optional<GameState> onEnter(Game context) {
|
||||
return sync(PlayingCard::new);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue