コード例 #1
0
        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;
        }
コード例 #2
0
 public GlowingFloorEvent(Mobile typedObject) : base(typedObject)
 {
     if (Dynamic.Level.ID == 16)
     {
         Dynamic._textPromptOffsetX = -20;
         Dynamic._textPromptText    = "Exit the pyramid";
         return;
     }
     if (Dynamic.Level.ID == 11 && Level.GameSave.GetSettings().BossRando.Value)
     {
         int            bossId = Dynamic.PrefabType.ToString() == "L11_SwitchWinderia" ? (int)EBossID.Prince : (int)EBossID.Vol;
         BossAttributes boss   = BestiaryManager.GetReplacedBoss(Level, bossId);
         Dynamic._textPromptOffsetX = -20;
         Dynamic._textPromptText    = $"Fight {boss.VisibleName}";
     }
 }
コード例 #3
0
        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,
            });
        }
コード例 #4
0
        protected override void Initialize(SeedOptions options)
        {
            bool isRandomized = Level.GameSave.GetSettings().BossRando.Value;

            if (!isRandomized)
            {
                return;
            }

            BossAttributes vanillaBoss = BestiaryManager.GetVanillaBoss(Level, (int)EBossID.Maw);

            if (vanillaBoss.Index != (int)EBossID.Prince && vanillaBoss.Index != (int)EBossID.Vol)
            {
                return;
            }

            Dynamic.SilentKill();

            //abort already triggered scripts
            ((List <ScriptAction>)LevelReflected._activeScripts).Clear();
            ((Queue <DialogueBox>)LevelReflected._dialogueQueue).Clear();
            ((Queue <ScriptAction>)LevelReflected._waitingScripts).Clear();
        }
コード例 #5
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);
        }
コード例 #6
0
 virtual protected void Awake()
 {
     bossAttributes = GetComponent <BossAttributes>();
     bossRenderer   = GetComponent <SpriteRenderer>();
 }