<commit_before>const DrawCard = require('../../drawcard.js');

class SerMerynTrant extends DrawCard {
    setupCardAbilities() {
        this.interrupt({
            when: {
                onCardDiscarded: event => event.originalLocation === 'hand' && event.card.controller !== this.controller
            },
            handler: context => {
                let card = context.event.card;
                let player = card.controller;
                player.moveCard(card, 'out of game');
                this.game.addMessage('{0} uses {1} to remove {2} from the game', this.controller, this, card);
            }
        });
    }
}

SerMerynTrant.code = '15029';

module.exports = SerMerynTrant;<commit_msg>Use replacement handler for Meryn Trant (#2851)<commit_after>const DrawCard = require('../../drawcard.js');

class SerMerynTrant extends DrawCard {
    setupCardAbilities() {
        this.interrupt({
            when: {
                onCardDiscarded: event => event.originalLocation === 'hand' && event.card.controller !== this.controller
            },
            message: {
                format: '{player} uses {source} to remove {card} from the game',
                args: { card: context => context.event.card }
            },
            handler: context => {
                context.event.replaceHandler(event => {
                    event.cardStateWhenDiscarded = event.card.createSnapshot();
                    event.card.controller.moveCard(event.card, 'out of game');
                });
            }
        });
    }
}

SerMerynTrant.code = '15029';

module.exports = SerMerynTrant;
{'fraction_non_alphanumeric': 0.12763320941759604, 'fraction_numerical': 0.010532837670384139, 'mean_word_length': 1.8942652329749103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2482470', 'n_tokens_mistral': 448, 'n_tokens_neox': 421, 'n_words': 93}