"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostSacrifice = void 0;
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
const cachedClasses_1 = require("../../core/cachedClasses");
const ModCallbackCustom_1 = require("../../enums/ModCallbackCustom");
const flag_1 = require("../../functions/flag");
const shouldFire_1 = require("../../shouldFire");
const CustomCallback_1 = require("../private/CustomCallback");
const v = {
    level: {
        numSacrifices: 0,
    },
};
class PostSacrifice extends CustomCallback_1.CustomCallback {
    v = v;
    constructor() {
        super();
        this.customCallbacksUsed = [
            [ModCallbackCustom_1.ModCallbackCustom.ENTITY_TAKE_DMG_PLAYER, this.entityTakeDmgPlayer],
        ];
    }
    shouldFire = shouldFire_1.shouldFirePlayer;
    // ModCallbackCustom.ENTITY_TAKE_DMG
    entityTakeDmgPlayer = (player, _amount, damageFlags, _source, _countdownFrames) => {
        const room = cachedClasses_1.game.GetRoom();
        const roomType = room.GetType();
        const isSpikeDamage = (0, flag_1.hasFlag)(damageFlags, isaac_typescript_definitions_1.DamageFlag.SPIKES);
        if (roomType === isaac_typescript_definitions_1.RoomType.SACRIFICE && isSpikeDamage) {
            v.level.numSacrifices++;
            this.fire(player, v.level.numSacrifices);
        }
        return undefined;
    };
}
exports.PostSacrifice = PostSacrifice;
