"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScarletSurvivor = void 0;
const divine_shield_1 = require("../../../keywords/divine-shield");
const THRESHOLD = 6;
const tryGrantDivineShieldOnce = (minion, board, hero, otherHero, gameState) => {
    if (minion.abiityChargesLeft <= 0 ||
        minion.attack < THRESHOLD ||
        minion.enchantments.some((e) => e.cardId === "BG35_814e")) {
        return;
    }
    minion.abiityChargesLeft = 0;
    (0, divine_shield_1.updateDivineShield)(minion, board, hero, otherHero, true, gameState);
    minion.enchantments.push({
        cardId: "BG35_814e",
        originEntityId: minion.entityId,
        timing: gameState.sharedState.currentEntityId++,
        tagScriptDataNum1: -1,
        tagScriptDataNum2: -1,
    });
};
exports.ScarletSurvivor = {
    cardIds: ["BG35_814", "BG35_814_G"],
    defaultCharges: (entity) => 1,
    onSpawned: (minion, input) => {
        const otherHero = input.gameState.gameState.player.player === input.hero
            ? input.gameState.gameState.opponent.player
            : input.gameState.gameState.player.player;
        tryGrantDivineShieldOnce(minion, input.board, input.hero, otherHero, input.gameState);
    },
    onStatsChanged: (minion, input) => {
        if (input.target.entityId !== minion.entityId) {
            return;
        }
        tryGrantDivineShieldOnce(minion, input.board, input.hero, input.otherHero, input.gameState);
    },
};
//# sourceMappingURL=scarlet-survivor.js.map