"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.incrementDeathrattlesTriggeredThisGame = exports.updateVolumizerBuffs = void 0;
const card_interface_1 = require("../cards/card.interface");
const _card_mappings_1 = require("../cards/impl/_card-mappings");
const stats_1 = require("../simulation/stats");
const utils_1 = require("../utils");
const updateVolumizerBuffs = (hero, board, attackBuff, healthBuff, gameState) => {
    hero.globalInfo.VolumizerAttackBuff += attackBuff;
    hero.globalInfo.VolumizerHealthBuff += healthBuff;
    for (const entity of board) {
        if ((0, utils_1.isVolumizer)(entity.cardId, hero, gameState.anomalies, gameState.allCards)) {
            (0, stats_1.modifyStats)(entity, hero, attackBuff, healthBuff, board, hero, gameState);
        }
    }
};
exports.updateVolumizerBuffs = updateVolumizerBuffs;
const incrementDeathrattlesTriggeredThisGame = (hero, board, gameState) => {
    var _a;
    const previousValue = (_a = hero.globalInfo.DeathrattlesTriggeredThisGame) !== null && _a !== void 0 ? _a : 0;
    hero.globalInfo.DeathrattlesTriggeredThisGame = previousValue + 1;
    for (const entity of board) {
        const cardImpl = _card_mappings_1.cardMappings[entity.cardId];
        if ((0, card_interface_1.hasOnGlobalInfoUpdated)(cardImpl)) {
            cardImpl.onGlobalInfoUpdated(entity, {
                type: 'DeathrattlesTriggeredThisGame',
                oldValue: previousValue,
                newValue: hero.globalInfo.DeathrattlesTriggeredThisGame,
                hero: hero,
                board: board,
                gameState: gameState,
            });
        }
    }
};
exports.incrementDeathrattlesTriggeredThisGame = incrementDeathrattlesTriggeredThisGame;
//# sourceMappingURL=player-global-effects.js.map