"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TideRaiser = void 0;
const cast_tavern_spell_1 = require("../../../mechanics/cast-tavern-spell");
const utils_1 = require("../../../services/utils");
const attack_1 = require("../../../simulation/attack");
exports.TideRaiser = {
    cardIds: ["BG34_920", "BG34_920_G"],
    deathrattleSpawn: (minion, input) => {
        const golden = minion.cardId === "BG34_920_G";
        const raw = (0, attack_1.getNeighbours)(input.boardWithDeadEntity, minion, input.deadEntityIndexFromRight)
            .filter((e) => !!e)
            .filter((e) => e.health > 0 && !e.definitelyDead);
        const targets = golden ? raw : raw.length ? [(0, utils_1.pickRandom)(raw)] : [];
        for (const t of targets) {
            (0, cast_tavern_spell_1.castTavernSpell)("BG32_815", {
                spellCardId: "BG32_815",
                source: input.boardWithDeadEntityHero,
                target: t,
                board: input.boardWithDeadEntity,
                hero: input.boardWithDeadEntityHero,
                otherBoard: input.otherBoard,
                otherHero: input.otherBoardHero,
                gameState: input.gameState,
            });
        }
        return [];
    },
};
//# sourceMappingURL=tide-raiser.js.map