"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RuthlessQueensguard = void 0;
const cast_tavern_spell_1 = require("../../../mechanics/cast-tavern-spell");
const utils_1 = require("../../../services/utils");
const castQueensCommand = (times, hero, board, otherBoard, otherHero, gameState) => {
    var _a;
    for (let i = 0; i < times; i++) {
        const alive = board.filter((e) => e.health > 0 && !e.definitelyDead);
        const target = (_a = (0, utils_1.pickRandom)(alive)) !== null && _a !== void 0 ? _a : alive[0];
        if (!target) {
            return;
        }
        (0, cast_tavern_spell_1.castTavernSpell)("BG35_922", {
            spellCardId: "BG35_922",
            source: hero,
            target,
            board,
            hero,
            otherBoard,
            otherHero,
            gameState,
        });
    }
};
exports.RuthlessQueensguard = {
    cardIds: ["BG34_926", "BG34_926_G"],
    battlecry: (minion, input) => {
        const times = minion.cardId === "BG34_926_G" ? 2 : 1;
        castQueensCommand(times, input.hero, input.board, input.otherBoard, input.otherHero, input.gameState);
        return true;
    },
    deathrattleSpawn: (minion, input) => {
        const times = minion.cardId === "BG34_926_G" ? 2 : 1;
        castQueensCommand(times, input.boardWithDeadEntityHero, input.boardWithDeadEntity, input.otherBoard, input.otherBoardHero, input.gameState);
        return [];
    },
    rally: (minion, input) => {
        const times = minion.cardId === "BG34_926_G" ? 2 : 1;
        castQueensCommand(times, input.attackingHero, input.attackingBoard, input.defendingBoard, input.defendingHero, input.gameState);
        return { dmgDoneByAttacker: 0, dmgDoneByDefender: 0 };
    },
};
//# sourceMappingURL=ruthless-queensguard.js.map