Support for eggmoves
This commit is contained in:
parent
c088386ba3
commit
38e6630c67
@ -87,6 +87,10 @@ public static class SpeciesDataLoader
|
|||||||
{
|
{
|
||||||
learnableMoves.AddLevelMove((byte)levelMove.Level, new StringKey(levelMove.Name));
|
learnableMoves.AddLevelMove((byte)levelMove.Level, new StringKey(levelMove.Name));
|
||||||
}
|
}
|
||||||
|
foreach (var eggMove in moves.EggMoves)
|
||||||
|
{
|
||||||
|
learnableMoves.AddEggMove(new StringKey(eggMove));
|
||||||
|
}
|
||||||
|
|
||||||
return learnableMoves;
|
return learnableMoves;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +154,11 @@ public interface IPokemon : IScriptSource
|
|||||||
/// are null.
|
/// are null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IReadOnlyList<ILearnedMove?> Moves { get; }
|
IReadOnlyList<ILearnedMove?> Moves { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether the Pokemon has a specific move in its current moveset.
|
||||||
|
/// </summary>
|
||||||
|
public bool HasMove(StringKey moveName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not the Pokemon is allowed to gain experience.
|
/// Whether or not the Pokemon is allowed to gain experience.
|
||||||
@ -528,6 +533,9 @@ public class PokemonImpl : ScriptSource, IPokemon
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IReadOnlyList<ILearnedMove?> Moves => _learnedMoves;
|
public IReadOnlyList<ILearnedMove?> Moves => _learnedMoves;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public bool HasMove(StringKey moveName) => Moves.Any(move => move?.MoveData.Name == moveName);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public bool AllowedExperience { get; set; }
|
public bool AllowedExperience { get; set; }
|
||||||
|
|
||||||
|
@ -14,6 +14,12 @@ public interface ILearnableMoves
|
|||||||
/// <param name="move">The move the Pokémon learns.</param>
|
/// <param name="move">The move the Pokémon learns.</param>
|
||||||
/// <returns>Whether the move was added successfully.</returns>
|
/// <returns>Whether the move was added successfully.</returns>
|
||||||
void AddLevelMove(LevelInt level, StringKey move);
|
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>
|
/// <summary>
|
||||||
/// Gets all moves a Pokémon can learn when leveling up to a specific level.
|
/// Gets all moves a Pokémon can learn when leveling up to a specific level.
|
||||||
@ -27,6 +33,11 @@ public interface ILearnableMoves
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The moves the Pokémon can learn through leveling up.</returns>
|
/// <returns>The moves the Pokémon can learn through leveling up.</returns>
|
||||||
IReadOnlyList<StringKey> GetDistinctLevelMoves();
|
IReadOnlyList<StringKey> GetDistinctLevelMoves();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all moves a Pokémon can learn by breeding.
|
||||||
|
/// </summary>
|
||||||
|
IReadOnlyList<StringKey> GetEggMoves();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -34,6 +45,8 @@ public class LearnableMovesImpl : ILearnableMoves
|
|||||||
{
|
{
|
||||||
private readonly Dictionary<LevelInt, List<StringKey>> _learnedByLevel = new();
|
private readonly Dictionary<LevelInt, List<StringKey>> _learnedByLevel = new();
|
||||||
private readonly HashSet<StringKey> _distinctLevelMoves = new();
|
private readonly HashSet<StringKey> _distinctLevelMoves = new();
|
||||||
|
|
||||||
|
private readonly List<StringKey> _eggMoves = new();
|
||||||
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@ -46,6 +59,14 @@ public class LearnableMovesImpl : ILearnableMoves
|
|||||||
_distinctLevelMoves.Add(move);
|
_distinctLevelMoves.Add(move);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void AddEggMove(StringKey move)
|
||||||
|
{
|
||||||
|
if (_eggMoves.Contains(move))
|
||||||
|
return;
|
||||||
|
_eggMoves.Add(move);
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IReadOnlyList<StringKey> GetLearnedByLevel(LevelInt level)
|
public IReadOnlyList<StringKey> GetLearnedByLevel(LevelInt level)
|
||||||
{
|
{
|
||||||
@ -59,4 +80,7 @@ public class LearnableMovesImpl : ILearnableMoves
|
|||||||
{
|
{
|
||||||
return _distinctLevelMoves.ToList();
|
return _distinctLevelMoves.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public IReadOnlyList<StringKey> GetEggMoves() => _eggMoves;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user