diff --git a/PkmnLib.Static/Species/LearnableMoves.cs b/PkmnLib.Static/Species/LearnableMoves.cs index d78148b..ecd70a4 100644 --- a/PkmnLib.Static/Species/LearnableMoves.cs +++ b/PkmnLib.Static/Species/LearnableMoves.cs @@ -33,6 +33,11 @@ public interface ILearnableMoves /// /// The moves the Pokémon can learn through leveling up. IReadOnlyList GetDistinctLevelMoves(); + + /// + /// Gets a list of all moves a Pokémon can learn up to a specific level. + /// + IReadOnlyList GetLearnableMovesUpToLevel(LevelInt level); /// /// Gets all moves a Pokémon can learn by breeding. @@ -81,6 +86,17 @@ public class LearnableMovesImpl : ILearnableMoves return _distinctLevelMoves.ToList(); } + /// + public IReadOnlyList GetLearnableMovesUpToLevel(LevelInt level) + { + var moves = new HashSet(); + foreach (var kvp in _learnedByLevel.TakeWhile(kvp => kvp.Key <= level)) + { + moves.UnionWith(kvp.Value); + } + return moves.ToList(); + } + /// public IReadOnlyList GetEggMoves() => _eggMoves; } \ No newline at end of file