Exemple #1
0
        public static void OnChangeRoom(Level level, SeedOptions seedOptions, ItemLocationMap itemLocations, int levelId, int roomId)
        {
            var roomKey = new RoomItemKey(levelId, roomId);

            if (RoomTriggers.TryGetValue(roomKey, out var trigger))
            {
                trigger.trigger(level, itemLocations[roomKey], seedOptions);
            }
        }
        public static void OnChangeRoom(
            Level level, SeedOptions seedOptions, ItemLocationMap itemLocations, int levelId, int roomId)
        {
            var roomKey = new RoomItemKey(levelId, roomId);

            if (TextReplacers.TryGetValue(roomKey, out var replacer))
            {
                replacer.replacer(level, itemLocations, seedOptions);
            }
        }
        public static void OnChangeRoom(
            Level level, SeedOptions seedOptions, SettingCollection gameSettings, ItemLocationMap itemLocations, ScreenManager screenManager,
            int levelId, int roomId)
        {
            var roomKey = new RoomItemKey(levelId, roomId);

            if (RoomTriggers.TryGetValue(roomKey, out var trigger))
            {
                trigger.trigger(level, itemLocations[roomKey], seedOptions, gameSettings, screenManager);
            }
        }
        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,
            });
        }
        void FixProgressiveNonProgressionItemsInSameRoom(Random random)
        {
            var progressiveItemLocationsPerType = ItemLocations
                                                  .Where(l => l.ItemInfo.Unlocks == R.None)
                                                  .Where(l => l.ItemInfo is PogRessiveItemInfo)
                                                  .GroupBy(l => l.ItemInfo);

            foreach (IGrouping <ItemInfo, ItemLocation> progressiveItemLocations in progressiveItemLocationsPerType)
            {
                RoomItemKey roomkey = null;

                foreach (var itemLocation in progressiveItemLocations)
                {
                    if (roomkey == null)
                    {
                        roomkey = itemLocation.Key.ToRoomItemKey();
                    }
                    else if (roomkey == itemLocation.Key.ToRoomItemKey())
                    {
                        SwapItemWithOtherNonProgressionItemsNotInRoom(itemLocation, random);
                    }
                }
            }
        }
 public RoomTrigger(int levelId, int roomId, Action <Level, ItemLocation, SeedOptions, SettingCollection, ScreenManager> triggerMethod)
 {
     key     = new RoomItemKey(levelId, roomId);
     trigger = triggerMethod;
 }
Exemple #7
0
 public RoomTrigger(int levelId, int roomId, Action <Level, ItemLocation, SeedOptions> triggerMethod)
 {
     key     = new RoomItemKey(levelId, roomId);
     trigger = triggerMethod;
 }
 TextReplacer(int level, int room, Action <Level, ItemLocationMap, SeedOptions> replacer)
 {
     key           = new RoomItemKey(level, room);
     this.replacer = replacer;
 }