{"size": 662, "ext": "js", "max_stars_repo_path": "action/ContinueAction.js", "max_stars_repo_name": "mkhorin/e-champ-durak", "max_stars_repo_stars_event_min_datetime": "2021-03-05T10:15:51.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-27T04:46:00.000Z", "max_issues_repo_path": "action/ContinueAction.js", "max_issues_repo_name": "mkhorin/e-champ-durak", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "action/ContinueAction.js", "max_forks_repo_name": "mkhorin/e-champ-durak", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.8275862069, "max_line_length": 69, "alphanum_fraction": 0.5302114804}
/**
 * @copyright Copyright (c)2021 Maxim Khorin <maksimovichu@gmail.com>
 */
'use strict';

const Base = require('./BaseAction');

module.exports = class ContinueAction extends Base {

    validate () {
        if (!this.validatePlayer() || !this.validateTurned()) {
            return false;
        }
        if (!this.play.finished) {
            return this.setError('Round is not over');
        }
        return true;
    }

    execute () {
        this.play.setHandReady(this.hand);
        for (const hand of this.play.hands) {
            if (!hand.turned) {
                return;
            }
        }
        this.play.startNextRound();
    }
};