"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostAmbushStarted = void 0;
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
const cachedClasses_1 = require("../../core/cachedClasses");
const ambush_1 = require("../../functions/ambush");
const shouldFire_1 = require("../../shouldFire");
const CustomCallback_1 = require("../private/CustomCallback");
const v = {
    room: {
        ambushActive: false,
    },
};
class PostAmbushStarted extends CustomCallback_1.CustomCallback {
    v = v;
    constructor() {
        super();
        this.callbacksUsed = [
            // 1
            [isaac_typescript_definitions_1.ModCallback.POST_UPDATE, this.postUpdate],
        ];
    }
    shouldFire = shouldFire_1.shouldFireAmbush;
    postUpdate = () => {
        if (v.room.ambushActive) {
            return;
        }
        const room = cachedClasses_1.game.GetRoom();
        const ambushActive = room.IsAmbushActive();
        if (!ambushActive) {
            return;
        }
        v.room.ambushActive = true;
        const ambushType = (0, ambush_1.getAmbushType)();
        if (ambushType !== undefined) {
            this.fire(ambushType);
        }
    };
}
exports.PostAmbushStarted = PostAmbushStarted;
