/// <summary> /// Build set of mimic items from the randomization pool which ice traps may use. /// </summary> /// <param name="itemList">Randomized items</param> /// <param name="appearance">Ice trap appearance setting</param> /// <param name="songs">Whether or not song items may be used as mimic</param> /// <returns>Mimic item set.</returns> public static HashSet <MimicItem> BuildIceTrapMimicSet(ItemList itemList, IceTrapAppearance appearance, bool songs = false) { var mimics = new HashSet <MimicItem>(); bool allowNonRandomized = false; do { foreach (var itemObj in itemList.Where(io => allowNonRandomized || io.IsRandomized)) { var index = itemObj.Item.GetItemIndex(); var allowSong = songs || !itemObj.Item.IsSong(); if (index.HasValue && allowSong) { var chestType = itemObj.Item.ChestType(); if ((appearance == IceTrapAppearance.MajorItems && chestType == ChestTypeAttribute.ChestType.LargeGold) || (appearance == IceTrapAppearance.MajorItems && chestType == ChestTypeAttribute.ChestType.SmallGold) || (appearance == IceTrapAppearance.JunkItems && chestType == ChestTypeAttribute.ChestType.SmallWooden) || (appearance == IceTrapAppearance.Anything)) { // Add mimic item to set. var mimicItem = new MimicItem(itemObj.Item); mimics.Add(mimicItem); } } } if (allowNonRandomized && mimics.Count == 0) { throw new Exception("Failed to build a Mimic set."); } allowNonRandomized = true; } while (mimics.Count == 0); return(mimics); }
/// <summary> /// Build set of mimic items from the randomization pool which ice traps may use. /// </summary> /// <param name="itemList">Randomized items</param> /// <param name="appearance">Ice trap appearance setting</param> /// <param name="songs">Whether or not song items may be used as mimic</param> /// <returns>Mimic item set.</returns> public static HashSet <MimicItem> BuildIceTrapMimicSet(ItemList itemList, IceTrapAppearance appearance, bool songs = false) { var mimics = new HashSet <MimicItem>(); foreach (var itemObj in itemList) { var index = itemObj.Item.GetItemIndex(); var allowSong = songs || !itemObj.Item.IsSong(); if (index.HasValue && allowSong) { var chestType = itemObj.Item.ChestType(); if ((appearance == IceTrapAppearance.MajorItems && chestType == ChestTypeAttribute.ChestType.LargeGold) || (appearance == IceTrapAppearance.MajorItems && chestType == ChestTypeAttribute.ChestType.SmallGold) || (appearance == IceTrapAppearance.JunkItems && chestType == ChestTypeAttribute.ChestType.SmallWooden) || (appearance == IceTrapAppearance.Anything)) { // Add mimic item to set. var mimicItem = new MimicItem(itemObj.Item); mimics.Add(mimicItem); } } } return(mimics); }