private void FetchGrubLocations(RandomizerState state) { if (RandomizerMod.Instance.Settings.RandomizeMimics) { if (RandomizerMod.Instance.Settings.RandomizeGrubs) { grubLocations = FetchLocationsByPool(state, "GrubItem"); } else { grubLocations = RandomizerMod.Instance.Settings._mimicPlacements .Where(kvp => !kvp.Value) .ToDictionary(kvp => kvp.Key, kvp => 1); } } else { if (RandomizerMod.Instance.Settings.RandomizeGrubs) { grubLocations = FetchLocationsByPool(state, "Grub"); } else { grubLocations = LogicManager.GetItemsByPool("Grub").ToDictionary(grub => grub, grub => 1); } } }
private void FetchGrubLocations(RandomizerState state) { if (RandomizerMod.Instance.Settings.RandomizeGrubs) { grubLocations = FetchLocationsByPool(state, "Grub"); } else { grubLocations = LogicManager.GetItemsByPool("Grub").ToDictionary(grub => grub, grub => 1); } }
private void FetchFlameLocations(RandomizerState state) { if (RandomizerMod.Instance.Settings.RandomizeGrimmkinFlames) { flameLocations = FetchLocationsByPool(state, "Flame"); } else { // Flames are not relevant for logic when they're not randomized, as the player starts with 6 of them already given. flameLocations = new Dictionary <string, int>(); } }
private void FetchFlameLocations(RandomizerState state) { if (state == RandomizerState.HelperLog || !RandomizerMod.Instance.Settings.RandomizeGrimmkinFlames) { // Flames are not relevant for logic when they're not randomized, as the player starts with 6 of them already given. // When in Helper Log mode, we do not want to add vanilla flame locations! flameLocations = new Dictionary <string, int>(); } else { flameLocations = FetchLocationsByPool(state, "Flame"); } }
private void FetchEggLocations(RandomizerState state) { if (!RandomizerMod.Instance.Settings.EggShop) { return; } if (RandomizerMod.Instance.Settings.RandomizeRancidEggs) { eggLocations = FetchLocationsByPool(state, "EggShopItem"); } else { // Easiest to simply ignore the egg at sly eggLocations = LogicManager.GetItemsByPool("Egg").Where(egg => LogicManager.GetItemDef(egg).type != ItemType.Shop) .ToDictionary(egg => egg, egg => 1); } }
public ProgressionManager(RandomizerState state, int[] progression = null, bool addSettings = true) { obtained = new int[LogicManager.bitMaskMax + 1]; if (progression != null) { progression.CopyTo(obtained, 0); } FetchEssenceLocations(state); FetchGrubLocations(state); if (addSettings) { ApplyDifficultySettings(); } RecalculateEssence(); RecalculateGrubs(); }
private Dictionary <string, int> FetchLocationsByPool(RandomizerState state, string pool) { Dictionary <string, int> locations; switch (state) { case RandomizerState.InProgress: return(new Dictionary <string, int>()); case RandomizerState.Validating: locations = ItemManager.nonShopItems.Where(kvp => LogicManager.GetItemDef(kvp.Value).pool == pool).ToDictionary(kvp => kvp.Key, kvp => 1); foreach (var kvp in ItemManager.shopItems) { if (kvp.Value.Any(item => LogicManager.GetItemDef(item).pool == pool)) { locations.Add(kvp.Key, kvp.Value.Count(item => LogicManager.GetItemDef(item).pool == pool)); } } return(locations); case RandomizerState.Completed: case RandomizerState.HelperLog: locations = RandomizerMod.Instance.Settings.ItemPlacements .Where(pair => LogicManager.GetItemDef(pair.Item1).pool == pool && !LogicManager.ShopNames.Contains(pair.Item2)) .ToDictionary(pair => pair.Item2, kvp => 1); foreach (string shop in LogicManager.ShopNames) { if (RandomizerMod.Instance.Settings.ItemPlacements.Any(pair => pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == pool)) { locations.Add(shop, RandomizerMod.Instance.Settings.ItemPlacements.Count(pair => pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == pool)); } } return(locations); default: Log("FetchLocationsByPool: unexpected RandomizerState"); return(new Dictionary <string, int>()); } }
private void FetchGrubLocations(RandomizerState state) { switch (state) { default: grubLocations = LogicManager.GetItemsByPool("Grub").ToDictionary(grub => grub, grub => 1); break; case RandomizerState.InProgress when RandomizerMod.Instance.Settings.RandomizeGrubs: grubLocations = new Dictionary <string, int>(); break; case RandomizerState.Validating when RandomizerMod.Instance.Settings.RandomizeGrubs: grubLocations = ItemManager.nonShopItems.Where(kvp => LogicManager.GetItemDef(kvp.Value).pool == "Grub").ToDictionary(kvp => kvp.Value, kvp => 1); foreach (var kvp in ItemManager.shopItems) { if (kvp.Value.Any(item => LogicManager.GetItemDef(item).pool == "Grub")) { grubLocations.Add(kvp.Key, kvp.Value.Count(item => LogicManager.GetItemDef(item).pool == "Grub")); } } break; case RandomizerState.Completed when RandomizerMod.Instance.Settings.RandomizeGrubs: grubLocations = RandomizerMod.Instance.Settings.ItemPlacements .Where(pair => LogicManager.GetItemDef(pair.Item1).pool == "Grub" && !LogicManager.ShopNames.Contains(pair.Item2)) .ToDictionary(pair => pair.Item2, kvp => 1); foreach (string shop in LogicManager.ShopNames) { if (RandomizerMod.Instance.Settings.ItemPlacements.Any(pair => pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == "Grub")) { grubLocations.Add(shop, RandomizerMod.Instance.Settings.ItemPlacements.Count(pair => pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == "Grub")); } } break; } }
private void FetchEssenceLocations(RandomizerState state) { essenceLocations = new Dictionary <string, int>(); FetchEssenceLocationsFromPool(state, "Root", RandomizerMod.Instance.Settings.RandomizeWhisperingRoots); FetchEssenceLocationsFromPool(state, "Essence_Boss", RandomizerMod.Instance.Settings.RandomizeBossEssence); }
private void FetchEssenceLocationsFromPool(RandomizerState state, string pool, bool poolRandomized) { switch (state) { default: foreach (string root in LogicManager.GetItemsByPool(pool)) { essenceLocations.Add(root, LogicManager.GetItemDef(root).geo); } break; case RandomizerState.InProgress when poolRandomized: case RandomizerState.HelperLog when poolRandomized: break; case RandomizerState.Validating when poolRandomized: foreach (var kvp in ItemManager.nonShopItems) { if (LogicManager.GetItemDef(kvp.Value).pool == pool) { essenceLocations.Add(kvp.Key, LogicManager.GetItemDef(kvp.Value).geo); } } foreach (var kvp in ItemManager.shopItems) { foreach (string item in kvp.Value) { if (LogicManager.GetItemDef(item).pool == pool) { if (!essenceLocations.ContainsKey(kvp.Key)) { essenceLocations.Add(kvp.Key, 0); } essenceLocations[kvp.Key] += LogicManager.GetItemDef(item).geo; } } } break; case RandomizerState.Completed when poolRandomized: foreach (var pair in RandomizerMod.Instance.Settings.ItemPlacements) { if (LogicManager.GetItemDef(pair.Item1).pool == pool && !LogicManager.ShopNames.Contains(pair.Item2)) { essenceLocations.Add(pair.Item2, LogicManager.GetItemDef(pair.Item1).geo); } } foreach (string shop in LogicManager.ShopNames) { if (RandomizerMod.Instance.Settings.ItemPlacements.Any(pair => pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == pool)) { essenceLocations.Add(shop, 0); foreach (var pair in RandomizerMod.Instance.Settings.ItemPlacements) { if (pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == pool) { essenceLocations[shop] += LogicManager.GetItemDef(pair.Item1).geo; } } } } break; } }
private void FetchEssenceLocations(RandomizerState state) { essenceLocations = LogicManager.GetItemsByPool("Essence_Boss") .ToDictionary(item => item, item => LogicManager.GetItemDef(item).geo); switch (state) { default: foreach (string root in LogicManager.GetItemsByPool("Root")) { essenceLocations.Add(root, LogicManager.GetItemDef(root).geo); } break; case RandomizerState.InProgress when RandomizerMod.Instance.Settings.RandomizeWhisperingRoots: break; case RandomizerState.Validating when RandomizerMod.Instance.Settings.RandomizeWhisperingRoots: foreach (var kvp in ItemManager.nonShopItems) { if (LogicManager.GetItemDef(kvp.Value).pool == "Root") { essenceLocations.Add(kvp.Key, LogicManager.GetItemDef(kvp.Value).geo); } } foreach (var kvp in ItemManager.shopItems) { foreach (string item in kvp.Value) { if (LogicManager.GetItemDef(item).pool == "Root") { if (!essenceLocations.ContainsKey(kvp.Key)) { essenceLocations.Add(kvp.Key, 0); } essenceLocations[kvp.Key] += LogicManager.GetItemDef(item).geo; } } } break; case RandomizerState.Completed when RandomizerMod.Instance.Settings.RandomizeWhisperingRoots: foreach (var pair in RandomizerMod.Instance.Settings.ItemPlacements) { if (LogicManager.GetItemDef(pair.Item1).pool == "Root" && !LogicManager.ShopNames.Contains(pair.Item2)) { essenceLocations.Add(pair.Item2, LogicManager.GetItemDef(pair.Item1).geo); } } foreach (string shop in LogicManager.ShopNames) { if (RandomizerMod.Instance.Settings.ItemPlacements.Any(pair => pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == "Root")) { essenceLocations.Add(shop, 0); foreach (var pair in RandomizerMod.Instance.Settings.ItemPlacements) { if (pair.Item2 == shop && LogicManager.GetItemDef(pair.Item1).pool == "Root") { essenceLocations[shop] += LogicManager.GetItemDef(pair.Item1).geo; } } } } break; } }