"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RaptorElder = void 0;
const reference_data_1 = require("@firestone-hs/reference-data");
const utils_1 = require("../../../utils");
const attackBuff = 3;
const healthBuff = 2;
exports.RaptorElder = {
    cardIds: ["BG33_842", "BG33_842_G"],
    onSpawned: (minion, input) => {
        const mult = minion.cardId === "BG33_842_G" ? 2 : 1;
        const baseBuff = input.hero.globalInfo.BeastsSummonedThisCombat * mult;
        const targets = input.board
            .filter((e) => (0, utils_1.hasCorrectTribe)(e, input.hero, reference_data_1.Race.BEAST, input.gameState.anomalies, input.gameState.allCards));
        for (const target of targets) {
            if (input.applyAttackAuras) {
                target.attack += attackBuff * baseBuff;
            }
            if (input.applyHealthAuras) {
                target.health += healthBuff * baseBuff;
            }
        }
    },
    onDespawned: (minion, input) => {
        const mult = minion.cardId === "BG33_842_G" ? 2 : 1;
        const baseBuff = input.hero.globalInfo.BeastsSummonedThisCombat * mult;
        const targets = input.board
            .filter((e) => e !== minion)
            .filter((e) => (0, utils_1.hasCorrectTribe)(e, input.hero, reference_data_1.Race.BEAST, input.gameState.anomalies, input.gameState.allCards));
        for (const target of targets) {
            if (input.applyAttackAuras) {
                target.attack = Math.max(0, target.attack - attackBuff * baseBuff);
            }
            if (input.applyHealthAuras) {
                target.health = Math.max(1, target.health - healthBuff * baseBuff);
            }
        }
    },
    onOtherSpawned: (minion, input) => {
        const mult = minion.cardId === "BG33_842_G" ? 2 : 1;
        const baseBuff = input.hero.globalInfo.BeastsSummonedThisCombat * mult;
        if (input.applySelfAuras &&
            (0, utils_1.hasCorrectTribe)(input.spawned, input.hero, reference_data_1.Race.BEAST, input.gameState.anomalies, input.gameState.allCards)) {
            input.spawned.attack += attackBuff * baseBuff;
            input.spawned.health += healthBuff * baseBuff;
        }
        if ((0, utils_1.hasCorrectTribe)(input.spawned, input.hero, reference_data_1.Race.BEAST, input.gameState.anomalies, input.gameState.allCards)) {
            const allTargets = input.board.filter((e) => (0, utils_1.hasCorrectTribe)(e, input.hero, reference_data_1.Race.BEAST, input.gameState.anomalies, input.gameState.allCards));
            for (const target of allTargets) {
                target.attack += attackBuff * mult;
                target.health += healthBuff * mult;
            }
        }
    },
};
//# sourceMappingURL=raptor-elder.js.map