package cards.maumau.model;

import cards.Card;
import cards.Suit;

public class SevenChosen implements HandlerState{
    private final ActionHandler handler;

    SevenChosen(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.getGame().getPlayerHandler().getCurrentPlayer().playCard(c);
            handler.increment7Counter();
            handler.getGame().getPlayerHandler().nextTurn(1);
        }
    }

    public void chooseSuit(Suit suit){}
    public void skip(){}
    
    public void no7(){
        if (handler.get7Counter() * 2 > handler.getGame().getCardHandler().getDrawPile().size()) {
            handler.setGameState(GameState.GAME_CANCELED);
            handler.setHandlerState(new Canceled(handler));
        } else {
            handler.getGame().getPlayerHandler().getCurrentPlayer().drawCards(2 * handler.get7Counter());
            handler.reset7Counter();
            handler.setHandlerState(new Normal(handler));
        }

    }
}
