<commit_before>const _ = require('underscore');

const PlotCard = require('../../../plotcard.js');

class MarchedToTheWall extends PlotCard {
    setupCardAbilities() {
        this.whenRevealed({
            handler: () => {
                this.remainingPlayers = this.game.getPlayersInFirstPlayerOrder();
                this.selections = [];
                this.proceedToNextStep();
            }
        });
    }

    cancelSelection(player) {
        this.game.addMessage('{0} has cancelled the resolution of {1}', player, this);
        this.proceedToNextStep();
    }

    onCardSelected(player, card) {
        this.selections.push({ player: player, card: card });
        this.game.addMessage('{0} has selected {1} to discard from {2}', player, card, this);
        this.proceedToNextStep();
        return true;
    }

    doDiscard() {
        _.each(this.selections, selection => {
            var player = selection.player;
            player.discardCard(selection.card, false);
        });
    }

    proceedToNextStep() {
        if(this.remainingPlayers.length > 0) {
            var currentPlayer = this.remainingPlayers.shift();
            this.game.promptForSelect(currentPlayer, {
                activePromptTitle: 'Select a character to discard',
                source: this,
                cardCondition: card => card.controller === currentPlayer && card.getType() === 'character',
                onSelect: (player, cards) => this.onCardSelected(player, cards),
                onCancel: (player) => this.cancelSelection(player)
            });
        } else {
            this.doDiscard();
        }
    }
}

MarchedToTheWall.code = '01015';

module.exports = MarchedToTheWall;<commit_msg>Only allowing discarding from play for Marched (#1005)<commit_after>const _ = require('underscore');

const PlotCard = require('../../../plotcard.js');

class MarchedToTheWall extends PlotCard {
    setupCardAbilities() {
        this.whenRevealed({
            handler: () => {
                this.remainingPlayers = this.game.getPlayersInFirstPlayerOrder();
                this.selections = [];
                this.proceedToNextStep();
            }
        });
    }

    cancelSelection(player) {
        this.game.addMessage('{0} has cancelled the resolution of {1}', player, this);
        this.proceedToNextStep();
    }

    onCardSelected(player, card) {
        this.selections.push({ player: player, card: card });
        this.game.addMessage('{0} has selected {1} to discard from {2}', player, card, this);
        this.proceedToNextStep();
        return true;
    }

    doDiscard() {
        _.each(this.selections, selection => {
            var player = selection.player;
            player.discardCard(selection.card, false);
        });
    }

    proceedToNextStep() {
        if(this.remainingPlayers.length > 0) {
            var currentPlayer = this.remainingPlayers.shift();
            this.game.promptForSelect(currentPlayer, {
                activePromptTitle: 'Select a character to discard',
                source: this,
                cardCondition: card => card.location === 'play area' && card.controller === currentPlayer && card.getType() === 'character',
                onSelect: (player, cards) => this.onCardSelected(player, cards),
                onCancel: (player) => this.cancelSelection(player)
            });
        } else {
            this.doDiscard();
        }
    }
}

MarchedToTheWall.code = '01015';

module.exports = MarchedToTheWall;
{'fraction_non_alphanumeric': 0.12940841865756542, 'fraction_numerical': 0.00739476678043231, 'mean_word_length': 2.1457960644007157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '245440', 'n_tokens_mistral': 997, 'n_tokens_neox': 950, 'n_words': 191}