/// <summary> /// Randomizes all foragables to a random season and location - does not yet handle fishing or dirt items /// </summary> /// <returns>A dictionary of locations to replace</returns> public static Dictionary <string, string> Randomize() { _allForagables = ItemList.Items.Values.Where(x => x.ShouldBeForagable).ToList(); SpringForagables.Clear(); SummerForagables.Clear(); FallForagables.Clear(); WinterForagables.Clear(); BeachForagables.Clear(); WoodsForagables.Clear(); DesertForagables.Clear(); var locationsReplacements = new Dictionary <string, string>(); GroupForagablesBySeason(); List <LocationData> foragableLocationDataList = GetForagableLocationDataList(); foreach (LocationData foragableLocationData in foragableLocationDataList) { locationsReplacements.Add(foragableLocationData.LocationName, foragableLocationData.ToString()); } WriteToSpoilerLog(foragableLocationDataList); if (!Globals.Config.RandomizeForagables) { PopulateDefaultForagables(); } return(locationsReplacements); }
/// <summary> /// Sets the foragable arrays to contain the vanilla foragables /// </summary> private static void PopulateDefaultForagables() { SpringForagables.Clear(); SummerForagables.Clear(); FallForagables.Clear(); WinterForagables.Clear(); BeachForagables.Clear(); WoodsForagables.Clear(); DesertForagables.Clear(); SpringForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.WildHorseradish], ItemList.Items[(int)ObjectIndexes.Daffodil], ItemList.Items[(int)ObjectIndexes.Leek], ItemList.Items[(int)ObjectIndexes.Dandelion] }); SummerForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.SpiceBerry], ItemList.Items[(int)ObjectIndexes.Grape], ItemList.Items[(int)ObjectIndexes.SweetPea] }); FallForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.WildPlum], ItemList.Items[(int)ObjectIndexes.Hazelnut], ItemList.Items[(int)ObjectIndexes.Blackberry], ItemList.Items[(int)ObjectIndexes.CommonMushroom], }); WinterForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.WinterRoot], ItemList.Items[(int)ObjectIndexes.CrystalFruit], ItemList.Items[(int)ObjectIndexes.SnowYam], ItemList.Items[(int)ObjectIndexes.Crocus], ItemList.Items[(int)ObjectIndexes.Holly], }); BeachForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.NautilusShell], ItemList.Items[(int)ObjectIndexes.Coral], ItemList.Items[(int)ObjectIndexes.SeaUrchin], ItemList.Items[(int)ObjectIndexes.RainbowShell], ItemList.Items[(int)ObjectIndexes.Clam], ItemList.Items[(int)ObjectIndexes.Cockle], ItemList.Items[(int)ObjectIndexes.Mussel], ItemList.Items[(int)ObjectIndexes.Oyster] }); WoodsForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.Morel], ItemList.Items[(int)ObjectIndexes.CommonMushroom], ItemList.Items[(int)ObjectIndexes.RedMushroom], ItemList.Items[(int)ObjectIndexes.FiddleheadFern], ItemList.Items[(int)ObjectIndexes.Chanterelle], }); DesertForagables.AddRange(new List <Item>() { ItemList.Items[(int)ObjectIndexes.CactusFruit], ItemList.Items[(int)ObjectIndexes.Coconut] }); }
/// <summary> /// Populate the location data's season arrays /// </summary> /// <param name="foragableLocationData">The location data</param> /// <param name="season">The season</param> private static void PopulateLocationBySeason(LocationData foragableLocationData, Seasons season) { List <ForagableData> foragableDataList = null; List <Item> foragableItemList = null; switch (season) { case Seasons.Spring: foragableDataList = foragableLocationData.SpringForagables; foragableItemList = SpringForagables; break; case Seasons.Summer: foragableDataList = foragableLocationData.SummerForagables; foragableItemList = SummerForagables; break; case Seasons.Fall: foragableDataList = foragableLocationData.FallForagables; foragableItemList = FallForagables; break; case Seasons.Winter: foragableDataList = foragableLocationData.WinterForagables; foragableItemList = WinterForagables; break; } if (foragableDataList == null || foragableItemList == null) { Globals.ConsoleError($"Could not get foragable list for season: {season}"); } if (foragableLocationData.Location == Locations.Desert) { foragableItemList = DesertForagables; } // Give the beach a random item from the season, then only assign the beach items after that if (foragableLocationData.Location == Locations.Beach) { Item randomSeasonItem = foragableItemList[Globals.RNG.Next(0, foragableItemList.Count)]; foragableDataList.Add(new ForagableData(randomSeasonItem.Id)); foragableItemList = BeachForagables; } // Give the woods a random item from ANY season, then only assign the woods items after that if (foragableLocationData.LocationName == "Woods") { AddUniqueNewForagable(WoodsForagables); foragableItemList = WoodsForagables; } foreach (Item item in foragableItemList) { foragableDataList.Add(new ForagableData(item.Id)); } // Remove the item that was added to the woods if (foragableLocationData.LocationName == "Woods" && WoodsForagables.Count > 1) { WoodsForagables.RemoveAt(WoodsForagables.Count - 1); } // Add a random item that's really rare to see Item randomItem = Globals.RNGGetRandomValueFromList( ItemList.Items.Values.Where(x => x.DifficultyToObtain >= ObtainingDifficulties.MediumTimeRequirements && x.DifficultyToObtain < ObtainingDifficulties.Impossible).ToList() ); foragableDataList.Add(new ForagableData(randomItem.Id) { ItemRarity = 0.001 }); }