"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimewarpedHag = void 0;
const reference_data_1 = require("@firestone-hs/reference-data");
const reborn_1 = require("../../../keywords/reborn");
const attack_1 = require("../../../simulation/attack");
const utils_1 = require("../../../utils");
exports.TimewarpedHag = {
    cardIds: ["BG34_Giant_342", "BG34_Giant_342_G"],
    startOfCombatTiming: 'start-of-combat',
    startOfCombat: (minion, input) => {
        const neighbours = (0, attack_1.getNeighbours)(input.playerBoard, minion, null, true);
        if (neighbours.length !== 2) {
            console.warn('TimewarpedHag: neighbours.length !== 2', (0, utils_1.stringifySimple)(input.playerBoard, input.gameState.allCards));
        }
        const targets = minion.cardId === "BG34_Giant_342_G" ? neighbours : [neighbours[1]];
        for (const target of targets) {
            if (!!target &&
                (0, utils_1.hasCorrectTribe)(target, input.playerEntity, reference_data_1.Race.UNDEAD, input.gameState.anomalies, input.gameState.allCards)) {
                (0, reborn_1.updateReborn)(target, true, input.playerBoard, input.playerEntity, input.opponentEntity, input.gameState);
                target.enchantments.push({
                    cardId: "BG31_HERO_801ptje",
                    originEntityId: minion.entityId,
                    timing: input.gameState.sharedState.currentEntityId++,
                    repeats: 1,
                });
            }
        }
        return true;
    },
};
//# sourceMappingURL=timewarped-hag.js.map