<commit_before>const DrawCard = require('../../../drawcard.js');
 
class CatelynStark extends DrawCard {
    constructor(owner, cardData) {
        super(owner, cardData);

        this.power = 0;
        this.lastPower = 0;
        
        this.registerEvents(['onCardSacrificed', 'onCharacterKilled', 'onBeginRound']);
    }

    updateStrength() {
        if(!this.inPlay || this.isBlank()) {
            return;
        }
        
        this.strengthModifier -= this.lastPower;
        this.strengthModifier += this.power;

        this.lastPower = this.owner.power;
    }

    onBeginRound() {
        this.abilityUsed = 0;
    }

    onCardSacrificed(event, player, card) {
        if(!this.inPlay || this.isBlank() || this.owner !== player || this.abilityUsed >= 2) {
            return;
        }

        if(card.getFaction() === this.getFaction() && card.getType() === 'character') {
            this.game.promptWithMenu(player, this, {
                activePrompt: {
                    menuTitle: 'Gain 1 power on ' + this.name + '?',
                    buttons: [
                        { text: 'Yes', command: 'menuButton', method: 'gainPower' },
                        { text: 'No', command: 'menuButton', method: 'cancel' }
                    ]
                },
                waitingPromptTitle: 'Waiting for opponent to use ' + this.name
            });
        }
    }

    onCharacterKilled(event, player, card) {
        this.onCardSacrificed(event, player, card);
    }<commit_msg>Catelyn Stark should not gain power when killed. (#115)<commit_after>const DrawCard = require('../../../drawcard.js');
 
class CatelynStark extends DrawCard {
    constructor(owner, cardData) {
        super(owner, cardData);

        this.power = 0;
        this.lastPower = 0;
        
        this.registerEvents(['onCardSacrificed', 'onCharacterKilled', 'onBeginRound']);
    }

    updateStrength() {
        if(!this.inPlay || this.isBlank()) {
            return;
        }
        
        this.strengthModifier -= this.lastPower;
        this.strengthModifier += this.power;

        this.lastPower = this.owner.power;
    }

    onBeginRound() {
        this.abilityUsed = 0;
    }

    onCardSacrificed(event, player, card) {
        if(!this.inPlay || this.isBlank() || this.owner !== player || this.abilityUsed >= 2) {
            return;
        }

        if(card === this) {
            return;
        }

        if(card.getFaction() === this.getFaction() && card.getType() === 'character') {
            this.game.promptWithMenu(player, this, {
                activePrompt: {
                    menuTitle: 'Gain 1 power on ' + this.name + '?',
                    buttons: [
                        { text: 'Yes', command: 'menuButton', method: 'gainPower' },
                        { text: 'No', command: 'menuButton', method: 'cancel' }
                    ]
                },
                waitingPromptTitle: 'Waiting for opponent to use ' + this.name
            });
        }
    }

    onCharacterKilled(event, player, card) {
        this.onCardSacrificed(event, player, card);
    }
{'fraction_non_alphanumeric': 0.13742409715564077, 'fraction_numerical': 0.004154682007031001, 'mean_word_length': 1.70995670995671, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '970782', 'n_tokens_mistral': 935, 'n_tokens_neox': 885, 'n_words': 171}