<commit_before>const DrawCard = require('../../drawcard.js');
const AbilityDsl = require('../../abilitydsl');
const { Locations, DuelTypes, CardTypes, Players } = require('../../Constants');

class DaimyosGunbai extends DrawCard {
    setupCardAbilities() {
        this.action({
            title: 'Initiate a military duel and attach this to the winner',
            condition: context => context.game.isDuringConflict(),
            location: Locations.Hand,
            targets: {
                challenger: {
                    cardType: CardTypes.Character,
                    controller: Players.Self,
                    cardCondition: card => card.isParticipating()
                },
                duelTarget: {
                    dependsOn: 'challenger',
                    cardType: CardTypes.Character,
                    controller: Players.Opponent,
                    player: Players.Opponent,
                    cardCondition: card => card.isParticipating(),
                    gameAction: AbilityDsl.actions.sequential([
                        AbilityDsl.actions.duel(context => ({
                            type: DuelTypes.Military,
                            challenger: context.targets.challenger,
                            gameAction: duel => AbilityDsl.actions.attach(context => ({
                                target: duel.winner,
                                attachment: context.source
                            }))
                        })),
                        AbilityDsl.actions.discardCard(context => ({
                            target: context.source.location === 'hand' ? context.source : []
                        }))
                    ])
                }
            }
        });
    }
}

DaimyosGunbai.id = 'daimyo-s-gunbai';

module.exports = DaimyosGunbai;<commit_msg>Daimyo's Gunbai bugifx (#3230)<commit_after>const DrawCard = require('../../drawcard.js');
const AbilityDsl = require('../../abilitydsl');
const { Locations, DuelTypes } = require('../../Constants');

class DaimyosGunbai extends DrawCard {
    setupCardAbilities() {
        this.action({
            title: 'Initiate a military duel and attach this to the winner',
            condition: context => context.game.isDuringConflict(),
            location: Locations.Hand,
            initiateDuel: {
                type: DuelTypes.Military,
                opponentChoosesDuelTarget: true,
                gameAction: duel => AbilityDsl.actions.attach(context => ({
                    target: duel.winner,
                    attachment: context.source
                }))
            },
            then: {
                thenCondition: () => true,
                gameAction: AbilityDsl.actions.discardCard(context => ({
                    target: context.source.location === 'hand' ? context.source : []
                }))
            }
        });
    }
}

DaimyosGunbai.id = 'daimyo-s-gunbai';

module.exports = DaimyosGunbai;
{'fraction_non_alphanumeric': 0.11215580926796508, 'fraction_numerical': 0.001343183344526528, 'mean_word_length': 1.4338235294117647, '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': '4880917', 'n_tokens_mistral': 789, 'n_tokens_neox': 732, 'n_words': 137}