"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JailerSticker306 = void 0;
const reference_data_1 = require("@firestone-hs/reference-data");
const utils_1 = require("../../../services/utils");
const cards_in_hand_1 = require("../../../simulation/cards-in-hand");
const utils_2 = require("../../../utils");
exports.JailerSticker306 = {
    cardIds: ["BG35_MagicItem_306t"],
    castTavernSpell: (_spellCardId, input) => {
        var _a;
        const undeadTargets = input.board.filter((e) => e.health > 0 &&
            !e.definitelyDead &&
            (0, utils_2.hasCorrectTribe)(e, input.hero, reference_data_1.Race.UNDEAD, input.gameState.anomalies, input.gameState.allCards));
        const target = input.target && undeadTargets.includes(input.target) ? input.target : (0, utils_1.pickRandom)(undeadTargets);
        if (!target)
            return;
        target.health = 0;
        target.definitelyDead = true;
        const tier = (_a = input.hero.tavernTier) !== null && _a !== void 0 ? _a : 6;
        const cardId = input.gameState.cardsData.getRandomMinionForTribe(reference_data_1.Race.UNDEAD, tier, []);
        if (cardId) {
            (0, cards_in_hand_1.addCardsInHand)(input.hero, input.board, [cardId], input.gameState);
        }
    },
};
//# sourceMappingURL=jailer-sticker-306.js.map