Support for eggmoves
This commit is contained in:
@@ -14,6 +14,12 @@ public interface ILearnableMoves
|
||||
/// <param name="move">The move the Pokémon learns.</param>
|
||||
/// <returns>Whether the move was added successfully.</returns>
|
||||
void AddLevelMove(LevelInt level, StringKey move);
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new egg move the Pokémon can learn.
|
||||
/// </summary>
|
||||
/// <param name="move"></param>
|
||||
void AddEggMove(StringKey move);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all moves a Pokémon can learn when leveling up to a specific level.
|
||||
@@ -27,6 +33,11 @@ public interface ILearnableMoves
|
||||
/// </summary>
|
||||
/// <returns>The moves the Pokémon can learn through leveling up.</returns>
|
||||
IReadOnlyList<StringKey> GetDistinctLevelMoves();
|
||||
|
||||
/// <summary>
|
||||
/// Gets all moves a Pokémon can learn by breeding.
|
||||
/// </summary>
|
||||
IReadOnlyList<StringKey> GetEggMoves();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -34,6 +45,8 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
{
|
||||
private readonly Dictionary<LevelInt, List<StringKey>> _learnedByLevel = new();
|
||||
private readonly HashSet<StringKey> _distinctLevelMoves = new();
|
||||
|
||||
private readonly List<StringKey> _eggMoves = new();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -46,6 +59,14 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
_distinctLevelMoves.Add(move);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void AddEggMove(StringKey move)
|
||||
{
|
||||
if (_eggMoves.Contains(move))
|
||||
return;
|
||||
_eggMoves.Add(move);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetLearnedByLevel(LevelInt level)
|
||||
{
|
||||
@@ -59,4 +80,7 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
{
|
||||
return _distinctLevelMoves.ToList();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetEggMoves() => _eggMoves;
|
||||
}
|
||||
Reference in New Issue
Block a user