"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onMinionFailedToSpawn = void 0;
const card_interface_1 = require("../cards/card.interface");
const _card_mappings_1 = require("../cards/impl/_card-mappings");
const utils_1 = require("../utils");
const stats_1 = require("./stats");
const onMinionFailedToSpawn = (entity, board, hero, gameState) => {
    if (entity === null || entity === void 0 ? void 0 : entity.onCanceledSummon) {
        entity.onCanceledSummon();
    }
    for (const boardEntity of board) {
        const onSpawnFailImp = _card_mappings_1.cardMappings[boardEntity.cardId];
        if ((0, card_interface_1.hasOnSpawnFail)(onSpawnFailImp)) {
            onSpawnFailImp.onSpawnFail(boardEntity, {
                failedSpawn: entity,
                board: board,
                hero: hero,
                gameState: gameState,
            });
        }
    }
    hero.trinkets
        .filter((t) => t.cardId === "BG30_MagicItem_438t")
        .forEach((t) => (0, utils_1.addStatsToBoard)(t, board, hero, 5, 0, gameState));
    board
        .filter((e) => e.cardId === "BG30_124" ||
        e.cardId === "BG30_124_G")
        .forEach((abom) => {
        const abomStatsMultiplier = abom.cardId === "BG30_124_G" ? 2 : 1;
        (0, stats_1.modifyStats)(abom, abom, abomStatsMultiplier * 3, abomStatsMultiplier * 3, board, hero, gameState);
    });
    board
        .filter((e) => e.cardId === "BG30_129" || e.cardId === "BG30_129_G")
        .forEach((crasher) => {
        const mult = crasher.cardId === "BG30_129" ? 1 : 2;
        (0, utils_1.addStatsToAliveBoard)(crasher, board, hero, 2 * mult, 2 * mult, gameState);
    });
};
exports.onMinionFailedToSpawn = onMinionFailedToSpawn;
//# sourceMappingURL=spawn-fail.js.map