"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbyssalBruiser = void 0;
const divine_shield_1 = require("../../../keywords/divine-shield");
const stats_1 = require("../../../simulation/stats");
exports.AbyssalBruiser = {
    cardIds: ["BG35_921", "BG35_921_G"],
    onSpawned: (minion, input) => {
        var _a;
        const mult = minion.cardId === "BG35_921_G" ? 2 : 1;
        const n = (_a = input.hero.globalInfo.TavernSpellsCastThisGame) !== null && _a !== void 0 ? _a : 0;
        if (input.applyAttackAuras) {
            minion.attack += n * mult;
            minion.maxAttack = minion.attack;
        }
        if (input.applyHealthAuras) {
            minion.health += n * mult;
            minion.maxHealth = Math.max(minion.maxHealth, minion.health);
        }
        const otherHero = input.gameState.gameState.player.player === input.hero
            ? input.gameState.gameState.opponent.player
            : input.gameState.gameState.player.player;
        (0, divine_shield_1.updateDivineShield)(minion, input.board, input.hero, otherHero, true, input.gameState);
    },
    onDespawned: (minion, input) => {
        var _a;
        const mult = minion.cardId === "BG35_921_G" ? 2 : 1;
        const n = (_a = input.hero.globalInfo.TavernSpellsCastThisGame) !== null && _a !== void 0 ? _a : 0;
        if (input.applyAttackAuras) {
            minion.attack = Math.max(0, minion.attack - n * mult);
            minion.maxAttack = Math.max(minion.maxAttack, minion.attack);
        }
        if (input.applyHealthAuras) {
            minion.health = Math.max(1, minion.health - n * mult);
            minion.maxHealth = Math.max(minion.maxHealth, minion.health);
        }
    },
    onTavernSpellCast: (entity, input) => {
        if (input.source !== input.hero) {
            return;
        }
        const mult = entity.cardId === "BG35_921_G" ? 2 : 1;
        (0, stats_1.modifyStats)(entity, entity, mult, mult, input.board, input.hero, input.gameState);
    },
};
//# sourceMappingURL=abyssal-bruiser.js.map