public bool SetRegenSettings(IEnumerable <string> lines) { var split = RegenUtil.Split(lines); bool any = false; foreach (var s in split) { var key = s.Key; var value = s.Value; switch (key) { case nameof(Ball): Ball = Aesthetics.GetBallFromString(value); break; case nameof(Shiny): ShinyType = Aesthetics.GetShinyType(value); break; case nameof(Language): Language = Aesthetics.GetLanguageId(value); break; case nameof(Ability): Ability = Enum.TryParse(value, out AbilityRequest ar) ? ar : AbilityRequest.Any; break; default: continue; } any = true; } return(any); }
public static int GetRegenAbility(int species, int gen, AbilityRequest ar) { var abils = GetInfo(gen)[species].Abilities; return(ar switch { AbilityRequest.Any => - 1, AbilityRequest.First => abils[0], AbilityRequest.Second => abils[1], AbilityRequest.NotHidden => abils[0], AbilityRequest.PossiblyHidden => abils[0], AbilityRequest.Hidden => abils.Count > 2 ? abils[2] : -1, _ => throw new ArgumentOutOfRangeException(), });