private IEnumerable <EncounterSlot> GetSlotsSpecificLevelTime(IReadOnlyList <EvoCriteria> chain, int time, int lvl) { foreach (var slot in Slots) { foreach (var evo in chain) { if (slot.Species != evo.Species) { continue; } if (slot.Form != evo.Form) { if (slot.Species != (int)Species.Unown || evo.Form >= 26) // Don't yield !? forms { break; } } if (!slot.IsLevelWithinRange(lvl)) { break; } if (!Time.Contains(time)) { break; } yield return(slot); break; } } }
internal static int RandomValidTime(this EncounterTime t1) { int val = Util.Rand.Next(1, 4); if (t1 == EncounterTime.Any) { return(val); } while (!t1.Contains(val)) { val = Util.Rand.Next(1, 4); } return(val); }
public static bool Contains(this EncounterTime t1, int t2) => t1.Contains((EncounterTime)t2);