Add helper method to get all learnable moves up to a specific level
This commit is contained in:
parent
f86ef53d51
commit
eb9a30bd41
|
@ -34,6 +34,11 @@ public interface ILearnableMoves
|
|||
/// <returns>The moves the Pokémon can learn through leveling up.</returns>
|
||||
IReadOnlyList<StringKey> GetDistinctLevelMoves();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of all moves a Pokémon can learn up to a specific level.
|
||||
/// </summary>
|
||||
IReadOnlyList<StringKey> GetLearnableMovesUpToLevel(LevelInt level);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all moves a Pokémon can learn by breeding.
|
||||
/// </summary>
|
||||
|
@ -81,6 +86,17 @@ public class LearnableMovesImpl : ILearnableMoves
|
|||
return _distinctLevelMoves.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetLearnableMovesUpToLevel(LevelInt level)
|
||||
{
|
||||
var moves = new HashSet<StringKey>();
|
||||
foreach (var kvp in _learnedByLevel.TakeWhile(kvp => kvp.Key <= level))
|
||||
{
|
||||
moves.UnionWith(kvp.Value);
|
||||
}
|
||||
return moves.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetEggMoves() => _eggMoves;
|
||||
}
|
Loading…
Reference in New Issue