This commit is contained in:
Johannes Schmelz 2024-06-09 23:08:55 +02:00
parent 87bc479f12
commit bd81bd07ad
8 changed files with 64 additions and 0 deletions

Binary file not shown.

View File

@ -1,5 +1,8 @@
package cards.maumau.model; package cards.maumau.model;
import cards.Card;
import cards.Suit;
public class Canceled implements GameState{ public class Canceled implements GameState{
private final ActionHandler handler; private final ActionHandler handler;
@ -7,4 +10,13 @@ public class Canceled implements GameState{
Canceled(ActionHandler handler) { Canceled(ActionHandler handler) {
this.handler = handler; this.handler = handler;
} }
public void addPlayer(Player player){}
public void startGame(){}
public void finishGame(){}
public void cancelGame(){}
public void chooseCard(Card c){}
public void chooseSuit(Suit suit){}
public void skip(){}
public void no7(){}
} }

View File

@ -1,9 +1,21 @@
package cards.maumau.model; package cards.maumau.model;
import cards.Card;
import cards.Suit;
public class Finished implements GameState{ public class Finished implements GameState{
private final ActionHandler handler; private final ActionHandler handler;
Finished(ActionHandler handler) { Finished(ActionHandler handler) {
this.handler = handler; this.handler = handler;
} }
public void addPlayer(Player player){}
public void startGame(){}
public void finishGame(){}
public void cancelGame(){}
public void chooseCard(Card c){}
public void chooseSuit(Suit suit){}
public void skip(){}
public void no7(){}
} }

View File

@ -1,9 +1,23 @@
package cards.maumau.model; package cards.maumau.model;
import cards.Card;
import cards.Suit;
public class Normal implements GameState{ public class Normal implements GameState{
private final ActionHandler handler; private final ActionHandler handler;
Normal(ActionHandler handler) { Normal(ActionHandler handler) {
this.handler = handler; this.handler = handler;
} }
public void addPlayer(Player player){}
public void startGame(){}
public void finishGame(){}
public void cancelGame(){
}
public void chooseCard(Card c){}
public void chooseSuit(Suit suit){}
public void skip(){}
public void no7(){}
} }

View File

@ -1,9 +1,35 @@
package cards.maumau.model; package cards.maumau.model;
import cards.Card;
import cards.Suit;
public class SevenChosen implements GameState{ public class SevenChosen implements GameState{
private final ActionHandler handler; private final ActionHandler handler;
SevenChosen(ActionHandler handler) { SevenChosen(ActionHandler handler) {
this.handler = handler; this.handler = handler;
} }
public void addPlayer(Player player){}
public void startGame(){}
public void finishGame(){}
public void cancelGame(){}
public void chooseCard(Card c){
if (handler.canPlay(c)) {
handler.getGame().getPlayerHandler().getCurrentPlayer().playCard(c);
handler.increment7Counter();
handler.getGame().getPlayerHandler().nextTurn(1);
} else {
}
}
public void chooseSuit(Suit suit){}
public void skip(){}
public void no7(){
handler.getGame().getPlayerHandler().getCurrentPlayer().drawCards(2 * handler.get7Counter());
handler.reset7Counter();
handler.setGameState(new Normal(handler));
}
} }