started on implementing functionality of GamesStates
This commit is contained in:
@@ -1,5 +1,47 @@
|
||||
package cards.maumau.model;
|
||||
|
||||
public class SuitChosen implements GameState{
|
||||
import cards.Card;
|
||||
import cards.Suit;
|
||||
import cards.Rank;
|
||||
|
||||
public class SuitChosen implements GameState{
|
||||
private final ActionHandler handler;
|
||||
|
||||
SuitChosen(ActionHandler 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.setChosenSuit(null);
|
||||
handler.getGame().getPlayerHandler().getCurrentPlayer().playCard(c);
|
||||
|
||||
if(c.rank() == Rank.SEVEN) {
|
||||
handler.increment7Counter();
|
||||
handler.getGame().getPlayerHandler().nextTurn(1);
|
||||
handler.setGameState(new SevenChosen(handler));
|
||||
} else if (c.rank() == Rank.EIGHT) {
|
||||
handler.getGame().getPlayerHandler().nextTurn(2);
|
||||
handler.setGameState(new Normal(handler));
|
||||
} else {
|
||||
handler.getGame().getPlayerHandler().nextTurn(1);
|
||||
handler.setGameState(new Normal(handler));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void chooseSuit(Suit suit){}
|
||||
|
||||
public void skip(){
|
||||
handler.getGame().getPlayerHandler().getCurrentPlayer().drawCards(1);
|
||||
handler.getGame().getPlayerHandler().nextTurn(1);
|
||||
}
|
||||
|
||||
public void no7(){}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user