static void SpawnBoss(Level level, SeedOptions seedOptions, int vanillaBossId)
        {
            if (!level.GameSave.GetSettings().BossRando.Value || TargetBossId == -1 || !level.GameSave.GetSaveBool("IsFightingBoss"))
            {
                return;
            }

            BossAttributes vanillaBossInfo  = BestiaryManager.GetBossAttributes(level, vanillaBossId);
            BossAttributes replacedBossInfo = BestiaryManager.GetReplacedBoss(level, vanillaBossId);

            level.JukeBox.StopSong();
            level.PlayCue(Timespinner.GameAbstractions.ESFX.FoleyWarpGyreIn);

            if (seedOptions.GasMaw && (vanillaBossId == (int)EBossID.Maw || (vanillaBossId == (int)EBossID.FelineSentry && level.GameSave.GetSaveBool("TSRando_IsVileteSaved"))))
            {
                FillRoomWithGas(level);
            }

            if (replacedBossInfo.ShouldSpawn)
            {
                ObjectTileSpecification bossTile = new ObjectTileSpecification();
                bossTile.Category = EObjectTileCategory.Enemy;
                bossTile.Layer    = ETileLayerType.Objects;
                bossTile.ObjectID = replacedBossInfo.TileId;
                bossTile.Argument = replacedBossInfo.Argument;
                bossTile.IsFlippedHorizontally = !replacedBossInfo.IsFacingLeft;

                var boss = replacedBossInfo.BossType.CreateInstance(false, replacedBossInfo.Position, level, replacedBossInfo.Sprite, -1, bossTile);
                level.AsDynamic().RequestAddObject(boss);
            }

            level.JukeBox.StopSong();
            level.JukeBox.PlaySong(vanillaBossInfo.Song);
            TargetBossId = -1;
        }
        static void CreateBossWarp(Level level, int vanillaBossId)
        {
            if (!level.GameSave.GetSettings().BossRando.Value)
            {
                return;
            }

            BestiaryManager.RefreshBossSaveFlags(level);
            BossAttributes vanillaBossInfo  = BestiaryManager.GetBossAttributes(level, vanillaBossId);
            BossAttributes replacedBossInfo = BestiaryManager.GetReplacedBoss(level, vanillaBossId);

            if (level.GameSave.GetSaveBool("TSRando_" + vanillaBossInfo.SaveName))
            {
                return;
            }

            TargetBossId = vanillaBossId;

            level.JukeBox.StopSong();
            RoomItemKey bossArena = replacedBossInfo.BossRoom;

            BestiaryManager.ClearBossSaveFlags(level, replacedBossInfo.ShouldSpawn);
            level.GameSave.SetValue("IsFightingBoss", true);

            EDirection facing = replacedBossInfo.IsFacingLeft ? EDirection.West : EDirection.East;

            level.RequestChangeLevel(new LevelChangeRequest
            {
                LevelID                   = bossArena.LevelId,
                RoomID                    = bossArena.RoomId,
                IsUsingWarp               = true,
                IsUsingWhiteFadeOut       = true,
                FadeInTime                = 0.5f,
                FadeOutTime               = 0.25f,
                EnterDirection            = facing,
                AdditionalBlackScreenTime = 0.5f,
            });
        }
Example #3
0
        protected override void Initialize(SeedOptions options)
        {
            isRandomized = Level.GameSave.GetSettings().BossRando.Value;
            int argument = 0;

            if (TypedObject.EnemyType == EEnemyTileType.EmperorBoss)
            {
                if (Dynamic._isPrinceEmperor)
                {
                    argument = 2;
                }
                else if (Dynamic._isViletianEmperor)
                {
                    argument = 1;
                }
            }

            var bestiaryEntry = Level.GCM.Bestiary.GetEntry(TypedObject.EnemyType, argument);
            int bossId        = bestiaryEntry.Index;

            currentBoss = BestiaryManager.GetBossAttributes(Level, bossId);
            vanillaBoss = isRandomized
                                ? BestiaryManager.GetVanillaBoss(Level, bossId)
                                : currentBoss;

            if (!isRandomized)
            {
                return;
            }

            Level.ToggleExits(false);
            Level.OpenAllBossDoors(-1f);
            Level.LockAllBossDoors(0.5f);

            Level.JukeBox.StopSong();
            Level.JukeBox.PlaySong(vanillaBoss.Song);
        }