"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimewarpedMrrrglr = void 0;
const reference_data_1 = require("@firestone-hs/reference-data");
const attack_1 = require("../../../simulation/attack");
const stats_1 = require("../../../simulation/stats");
const utils_1 = require("../../../utils");
exports.TimewarpedMrrrglr = {
    cardIds: ["BG34_Giant_321", "BG34_Giant_321_G"],
    startOfCombatTiming: 'start-of-combat',
    startOfCombat: (minion, input) => {
        var _a, _b, _c, _d;
        const targets = (0, attack_1.getNeighbours)(input.playerBoard, minion);
        const mult = minion.cardId === "BG34_Giant_321_G" ? 2 : 1;
        const totalAttackInHand = (_b = (_a = input.playerEntity.hand) === null || _a === void 0 ? void 0 : _a.map((e) => { var _a; return (_a = e.attack) !== null && _a !== void 0 ? _a : 0; }).reduce((a, b) => a + b, 0)) !== null && _b !== void 0 ? _b : 0;
        const totalHealthInHand = (_d = (_c = input.playerEntity.hand) === null || _c === void 0 ? void 0 : _c.map((e) => { var _a; return (_a = e.health) !== null && _a !== void 0 ? _a : 0; }).reduce((a, b) => a + b, 0)) !== null && _d !== void 0 ? _d : 0;
        const attackBuff = totalAttackInHand || (minion.gildedInCombat ? 0 : input.playerEntity.globalInfo.ChoralAttackBuff) || 0;
        const healthBuff = totalHealthInHand || (minion.gildedInCombat ? 0 : input.playerEntity.globalInfo.ChoralHealthBuff) || 0;
        for (let i = 0; i < mult; i++) {
            for (const target of targets) {
                if ((0, utils_1.hasCorrectTribe)(target, input.playerEntity, reference_data_1.Race.MURLOC, input.gameState.anomalies, input.gameState.allCards)) {
                    (0, stats_1.modifyStats)(target, minion, attackBuff, healthBuff, input.playerBoard, input.playerEntity, input.gameState);
                }
            }
        }
        return true;
    },
};
//# sourceMappingURL=timewarped-mrrrglr.js.map