Пример #1
0
 void ResetRunData()
 {
     MapsAvailable.Clear();
     MapsAvailable.AddRange(Maps.MapList.Where(map => - 2 <= map.Rating && map.Rating <= 2));
     MapsVisited.Clear();
     MapLabels.Clear();
 }
Пример #2
0
        public void ActivateFirstMap()
        {
#if DEBUG
            Console.WriteLine($"Requesting first map with level: {MapLevel}");
#endif
            Console.WriteLine("Travelling to Lordran...");

            MapLevel = 1;                // should already be done in EMEVD cleanup

            Map firstMap = GetNextMap(); // Any map rated from -1 to 1.

            // Get random start point.
            Connection startPoint = GetStartPoint(firstMap, 0, ignoreDepth: true);
#if DEBUG
            Console.WriteLine($"Activating first map: {firstMap.Name}");
            Console.WriteLine($"    Labels: {string.Join(", ", MapLabels[firstMap])}");
            Console.WriteLine($"    Start point index: {startPoint.IndexInLevel}");
#endif
            foreach (int startFlag in startPoint.AllStartFlags)
            {
#if DEBUG
                Console.WriteLine($"    Enabling start flag: {startFlag}");
#endif
                EnableFlag(startFlag);  // "disable end" flag and other miscellaneous flags to enable (e.g. boss dead).
            }

            DisableFlag(GameFlag.DisableAbyssPortal);  // Reset Abyss portal for new map.

            // Disable map's "dead enemies" flags.
            for (int i = 0; i < 100; i++)
            {
                DisableFlag(firstMap.DeadEnemyFlagBase + i);
            }

            // Reset shop stocks of Motes/Tomes.
            for (int i = 0; i < 100; i++)
            {
                DisableFlag(11027000 + i);  // Includes "bonfire shop" (11027090).
            }
            MapGenerator.GenerateMapData(firstMap, redPhantomOdds: GetFlag(GameFlag.MornsteinRingFlag) ? 0.2 : 0.1);

            CurrentMap = firstMap;
            foreach (var map in Maps.MapList)
            {
                DisableFlag(map.InMapFlag);
            }
            EnableFlag(CurrentMap.InMapFlag);

            MapsAvailable.Remove(firstMap);
            MapsVisited.Add(firstMap);
            EnableFlag(firstMap.IsVisitedFlag);

            DisableFlag(GameFlag.OneBonfireCreated);
            DisableFlag(GameFlag.TwoBonfiresCreated);

            EnableFlag(GameFlag.RunSetupCompleteFlag);
            EnableFlag(GameFlag.RequestLevelMessageBase + MapLevel - 1);
            EnableFlag(startPoint.WarpRequestFlag);
        }
Пример #3
0
 void ResetRunData()
 {
     InvadersAvailable.Clear();
     InvadersAvailable.AddRange(Enumerable.Range(0, 30));
     InvadersUsed.Clear();
     BossCategoriesUsed.Clear();
     MapsAvailable.Clear();
     MapsAvailable.AddRange(Maps.MapList.Where(map => - 2 <= map.Rating && map.Rating <= 2));
     MapsVisited.Clear();
     MapLabels.Clear();
 }
Пример #4
0
 void LoadExistingRun()
 {
     // Load data from game flags about a run that is already underway.
     ResetRunData();
     List <Label> allLabels = new List <Label>(Enum.GetValues(typeof(Label)).Cast <Label>());
     {
         foreach (MapInfo map in Maps.MapList)
         {
             if (GetFlag(map.IsVisitedFlag))
             {
                 MapsAvailable.Remove(map);
                 MapsVisited.Add(map);
             }
             MapLabels[map] = new List <Label>(allLabels.Where(label => GetFlag(map.HasLabelFlagBase + (int)label)));
             if (GetFlag(map.InMapFlag))
             {
                 CurrentMap = map;
             }
         }
     }
 }
Пример #5
0
        void LoadExistingRun()
        {
            // Load data from game flags about a run that is already underway.
            ResetRunData();
            List <Label> allLabels = new List <Label>(Enum.GetValues(typeof(Label)).Cast <Label>());

            {
                foreach (Map map in Maps.MapList)
                {
                    if (GetFlag(map.IsVisitedFlag))
                    {
                        MapsAvailable.Remove(map);
                        MapsVisited.Add(map);
                    }
                    MapLabels[map] = new List <Label>(allLabels.Where(label => GetFlag(map.HasLabelFlagBase + (int)label)));
                    if (GetFlag(map.InMapFlag))
                    {
                        CurrentMap = map;
                    }
                }
                int maxBossCategory = EnemyGenerator.LastBossCategory;
                for (int category = 0; category <= maxBossCategory; category++)
                {
                    if (GetFlag(GameFlag.BossCategoryUsedBaseFlag + category))
                    {
                        BossCategoriesUsed.Add(category);
                    }
                }
            }

            foreach (int invader in InvadersAvailable.ToArray())
            {
                if (GetFlag(GameFlag.InvaderUsedBaseFlag + invader))
                {
                    InvadersAvailable.Remove(invader);
                    InvadersUsed.Add(invader);
                }
            }
        }
Пример #6
0
        public MapInfo ActivateMap(int triggerFlag)
        {
            // Enemies get harder (unless at max).
            if (MapLevel < 10)
            {
                MapLevel += 1;
            }

#if DEBUG
            Console.WriteLine($"Requesting map with level: {MapLevel}");
#endif

            MapInfo    newMap     = GetNextMap();
            Connection startPoint = GetStartPoint(newMap, 0, ignoreDepth: true);

#if DEBUG
            Console.WriteLine($"Activating map: {newMap.Name}");
            Console.WriteLine($"    Labels: {string.Join(", ", MapLabels[newMap])}");
            Console.WriteLine($"    Start point index: {startPoint.IndexInLevel}");
#endif
            // Disable map's "dead enemies" flags.
            for (int i = 0; i < 100; i++)
            {
                DisableFlag(newMap.DeadEnemyFlagBase + i);
            }

            // Reset shop stocks of Motes/Tomes.
            for (int i = 0; i < 100; i++)
            {
                DisableFlag(11027000 + i);  // Includes "bonfire shop" (11027090).
            }
            // Generate MSB, LUABND, FFXBND, and tweaked EMEVD for new map.
            double       redPhantomOdds = GetFlag(GameFlag.MornsteinRingFlag) ? 0.2 : 0.1;
            MapGenerator mapGen         = new MapGenerator(Mod, this, newMap, Rand, redPhantomOdds, startPoint);
            mapGen.Generate();

            foreach (int startFlag in startPoint.AllStartFlags)
            {
#if DEBUG
                Console.WriteLine($"    Enabling start flag: {startFlag}");
#endif
                EnableFlag(startFlag);                // "disable end" flag and other miscellaneous flags to enable (e.g. boss dead).
            }
            DisableFlag(GameFlag.DisableAbyssPortal); // Reset Abyss portal for new map.
            DisableFlag(GameFlag.AbyssBattleActive);
            if (newMap.Name != "Painted World")       // Current map is not updated when you're in the Painted World, which is only temporary.
            {
                CurrentMap = newMap;
                foreach (var map in Maps.MapList)
                {
                    DisableFlag(map.InMapFlag);
                }
                EnableFlag(CurrentMap.InMapFlag);
            }
            MapsAvailable.Remove(newMap);
            MapsVisited.Add(newMap);
            EnableFlag(newMap.IsVisitedFlag);  // Painted World also marked as visited here.

            DisableFlag(GameFlag.OneBonfireCreated);
            DisableFlag(GameFlag.TwoBonfiresCreated);

            Hook.LastBonfire = startPoint.SpawnPointID;

            EnableFlag(GameFlag.RequestLevelMessageBase + MapLevel - 1);
            EnableFlag(startPoint.WarpRequestFlag);
            return(newMap);
        }