"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostPlayerChangeType = void 0;
const ModCallbackCustom_1 = require("../../enums/ModCallbackCustom");
const playerDataStructures_1 = require("../../functions/playerDataStructures");
const shouldFire_1 = require("../../shouldFire");
const DefaultMap_1 = require("../DefaultMap");
const CustomCallback_1 = require("../private/CustomCallback");
const v = {
    run: {
        playersCharacterMap: new DefaultMap_1.DefaultMap((character) => character), // eslint-disable-line isaacscript/strict-enums
    },
};
class PostPlayerChangeType extends CustomCallback_1.CustomCallback {
    v = v;
    constructor() {
        super();
        this.customCallbacksUsed = [
            [
                ModCallbackCustom_1.ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED,
                this.postPEffectReordered,
            ],
        ];
    }
    shouldFire = shouldFire_1.shouldFirePlayer;
    // ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED
    postPEffectReordered = (player) => {
        const character = player.GetPlayerType();
        const storedCharacter = (0, playerDataStructures_1.defaultMapGetPlayer)(v.run.playersCharacterMap, player, character);
        if (character !== storedCharacter) {
            (0, playerDataStructures_1.mapSetPlayer)(v.run.playersCharacterMap, player, character);
            this.fire(player, storedCharacter, character);
        }
    };
}
exports.PostPlayerChangeType = PostPlayerChangeType;
