"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClunkerJunker = void 0;
const reference_data_1 = require("@firestone-hs/reference-data");
const utils_1 = require("../../../services/utils");
const magnetize_1 = require("../../../simulation/magnetize");
const utils_2 = require("../../../utils");
exports.ClunkerJunker = {
    cardIds: ["BG29_503", "BG29_503_G"],
    battlecry: (minion, input) => {
        var _a;
        const boardWithMechs = input.board.filter((e) => (0, utils_2.hasCorrectTribe)(e, input.hero, reference_data_1.Race.MECH, input.gameState.anomalies, input.gameState.allCards));
        const junkerTarget = (0, utils_1.pickRandom)(boardWithMechs);
        if (junkerTarget) {
            const numberOfMagnetizes = minion.cardId === "BG29_503" ? 1 : 2;
            for (let i = 0; i < numberOfMagnetizes; i++) {
                const minionToMagnetize = input.gameState.cardsData.getRandomMechToMagnetize((_a = input.hero.tavernTier) !== null && _a !== void 0 ? _a : 1);
                if (minionToMagnetize) {
                    input.gameState.spectator.registerPowerTarget(minion, junkerTarget, input.board, null, null);
                    (0, magnetize_1.magnetizeToTarget)([junkerTarget], minion, [minionToMagnetize], input.board, input.hero, input.otherBoard, input.otherHero, input.gameState);
                }
            }
        }
        return true;
    },
};
//# sourceMappingURL=clunker-junker.js.map