"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostAmbushFinished = 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: {
        ambushDone: false,
    },
};
class PostAmbushFinished 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.ambushDone) {
            return;
        }
        const room = cachedClasses_1.game.GetRoom();
        const ambushDone = room.IsAmbushDone();
        if (!ambushDone) {
            return;
        }
        v.room.ambushDone = true;
        const ambushType = (0, ambush_1.getAmbushType)();
        if (ambushType !== undefined) {
            this.fire(ambushType);
        }
    };
}
exports.PostAmbushFinished = PostAmbushFinished;
