"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlyingDetection = void 0;
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
const decorators_1 = require("../../../decorators");
const ISCFeature_1 = require("../../../enums/ISCFeature");
const Feature_1 = require("../../private/Feature");
const FLYING_NULL_ITEMS = [
    isaac_typescript_definitions_1.NullItemID.REVERSE_SUN,
    isaac_typescript_definitions_1.NullItemID.SPIRIT_SHACKLES_SOUL,
    isaac_typescript_definitions_1.NullItemID.LOST_CURSE, // 112
];
class FlyingDetection extends Feature_1.Feature {
    moddedElementSets;
    /** @internal */
    constructor(moddedElementSets) {
        super();
        this.featuresUsed = [ISCFeature_1.ISCFeature.MODDED_ELEMENT_SETS];
        this.moddedElementSets = moddedElementSets;
    }
    /**
     * Helper function to see if the player currently has flying from a temporary effect such as
     * Hanged Man, Bat Wing, and so on.
     *
     * In order to use this function, you must upgrade your mod with `ISCFeature.FLYING_DETECTION`.
     *
     * @public
     */
    hasFlyingTemporaryEffect(player) {
        const effects = player.GetEffects();
        // - We specify true to the `getFlyingCollectibles` function since conditional flying
        //   collectibles will only grant a temporary effect if their condition is activated.
        // - The Hanged Man card gives a Transcendence temporary effect.
        // - Pinking Shears gives a Transcendence temporary effect.
        const flyingCollectibles = this.moddedElementSets.getFlyingCollectibleTypes(true);
        for (const collectibleType of flyingCollectibles) {
            if (effects.HasCollectibleEffect(collectibleType)) {
                return true;
            }
        }
        const flyingTrinkets = this.moddedElementSets.getFlyingTrinketTypes();
        for (const trinketType of flyingTrinkets) {
            if (effects.HasTrinketEffect(trinketType)) {
                return true;
            }
        }
        for (const nullItemID of FLYING_NULL_ITEMS) {
            if (effects.HasNullEffect(nullItemID)) {
                return true;
            }
        }
        return false;
    }
}
exports.FlyingDetection = FlyingDetection;
__decorate([
    decorators_1.Exported
], FlyingDetection.prototype, "hasFlyingTemporaryEffect", null);
