"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackToBack = void 0;
const utils_1 = require("../../../services/utils");
const stats_1 = require("../../../simulation/stats");
const utils_2 = require("../../../utils");
exports.BackToBack = {
    cardIds: ["BG35_952"],
    castTavernSpell: (_spellCardId, input) => {
        var _a;
        let target = input.target;
        if (!target) {
            const candidates = [...input.board, ...input.otherBoard].filter((e) => e.health > 0 && !e.definitelyDead);
            target = (0, utils_1.pickRandom)(candidates);
        }
        if (!target)
            return;
        const previousCasts = (_a = input.hero.globalInfo.BackToBackCastThisGame) !== null && _a !== void 0 ? _a : 0;
        const mult = 1 + previousCasts;
        const { attack, health } = (0, utils_2.withTavernSpellStatBuff)(input.hero, 4, 4, input.gameState.allCards, input.spellCardId);
        const hero = input.board.includes(target) ? input.hero : input.otherHero;
        const board = input.board.includes(target) ? input.board : input.otherBoard;
        (0, stats_1.modifyStats)(target, input.source, attack * mult, health * mult, board, hero, input.gameState);
        input.hero.globalInfo.BackToBackCastThisGame = previousCasts + 1;
    },
};
//# sourceMappingURL=back-to-back.js.map