Further work on static side
This commit is contained in:
@@ -3,15 +3,10 @@ using PkmnLib.Static.Utils;
|
||||
namespace PkmnLib.Static.Species;
|
||||
|
||||
/// <summary>
|
||||
/// An ability is a passive effect in battle that is attached to a Pokemon.
|
||||
/// An ability is a passive effect in battle that is attached to a Pokémon.
|
||||
/// </summary>
|
||||
public interface IAbility
|
||||
public interface IAbility : INamedValue
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the ability.
|
||||
/// </summary>
|
||||
StringKey Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the script effect of the ability. This should refer to the name of the script that will be executed
|
||||
/// when the ability is triggered.
|
||||
|
||||
@@ -3,12 +3,12 @@ using PkmnLib.Static.Utils;
|
||||
namespace PkmnLib.Static.Species;
|
||||
|
||||
/// <summary>
|
||||
/// Data about how and into which Pokemon a species can evolve.
|
||||
/// Data about how and into which Pokémon a species can evolve.
|
||||
/// </summary>
|
||||
public interface IEvolution
|
||||
{
|
||||
/// <summary>
|
||||
/// The species that the Pokemon evolves into.
|
||||
/// The species that the Pokémon evolves into.
|
||||
/// </summary>
|
||||
StringKey ToSpecies { get; }
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public interface IEvolution
|
||||
public record LevelEvolution : IEvolution
|
||||
{
|
||||
/// <summary>
|
||||
/// The level at which the Pokemon evolves.
|
||||
/// The level at which the Pokémon evolves.
|
||||
/// </summary>
|
||||
public required uint Level { get; init; }
|
||||
|
||||
@@ -28,17 +28,17 @@ public record LevelEvolution : IEvolution
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when a certain level is reached, and the Pokemon is a specific gender
|
||||
/// Evolves when a certain level is reached, and the Pokémon is a specific gender
|
||||
/// </summary>
|
||||
public record LevelGenderEvolution : IEvolution
|
||||
{
|
||||
/// <summary>
|
||||
/// The level at which the Pokemon evolves.
|
||||
/// The level at which the Pokémon evolves.
|
||||
/// </summary>
|
||||
public required uint Level { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The gender the Pokemon needs to have to evolve
|
||||
/// The gender the Pokémon needs to have to evolve
|
||||
/// </summary>
|
||||
public required Gender Gender { get; init; }
|
||||
|
||||
@@ -47,7 +47,7 @@ public record LevelGenderEvolution : IEvolution
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when an item is used on the Pokemon.
|
||||
/// Evolves when an item is used on the Pokémon.
|
||||
/// </summary>
|
||||
public record ItemUseEvolution : IEvolution
|
||||
{
|
||||
@@ -61,7 +61,7 @@ public record ItemUseEvolution : IEvolution
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when an item is used on the Pokemon, and the Pokemon is a specific gender
|
||||
/// Evolves when an item is used on the Pokémon, and the Pokémon is a specific gender
|
||||
/// </summary>
|
||||
public record ItemGenderEvolution : IEvolution
|
||||
{
|
||||
@@ -71,7 +71,7 @@ public record ItemGenderEvolution : IEvolution
|
||||
public required StringKey Item { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The gender the Pokemon needs to have to evolve
|
||||
/// The gender the Pokémon needs to have to evolve
|
||||
/// </summary>
|
||||
public Gender Gender { get; init; }
|
||||
|
||||
@@ -80,7 +80,7 @@ public record ItemGenderEvolution : IEvolution
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when an item is held by the Pokemon, and the Pokemon levels up.
|
||||
/// Evolves when an item is held by the Pokémon, and the Pokémon levels up.
|
||||
/// </summary>
|
||||
public record HoldItemEvolution : IEvolution
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public record HoldItemEvolution : IEvolution
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when an item is held by the Pokemon, and the Pokemon levels up, and it's day.
|
||||
/// Evolves when an item is held by the Pokémon, and the Pokémon levels up, and it's day.
|
||||
/// </summary>
|
||||
public record DayHoldItemEvolution : IEvolution
|
||||
{
|
||||
@@ -103,12 +103,12 @@ public record DayHoldItemEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required StringKey Item { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when an item is held by the Pokemon, and the Pokemon levels up, and it's night.
|
||||
/// Evolves when an item is held by the Pokémon, and the Pokémon levels up, and it's night.
|
||||
/// </summary>
|
||||
public record NightHoldItemEvolution : IEvolution
|
||||
{
|
||||
@@ -117,12 +117,12 @@ public record NightHoldItemEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required StringKey Item { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when the Pokemon knows a certain move, and the Pokemon levels up.
|
||||
/// Evolves when the Pokémon knows a certain move, and the Pokémon levels up.
|
||||
/// </summary>
|
||||
public record HasMoveEvolution : IEvolution
|
||||
{
|
||||
@@ -131,12 +131,12 @@ public record HasMoveEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required StringKey MoveName { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when above a certain happiness level, and the Pokemon levels up.
|
||||
/// Evolves when above a certain happiness level, and the Pokémon levels up.
|
||||
/// </summary>
|
||||
public record HappinessEvolution : IEvolution
|
||||
{
|
||||
@@ -145,12 +145,12 @@ public record HappinessEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required byte Happiness { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when above a certain happiness level, and the Pokemon levels up, and it's day.
|
||||
/// Evolves when above a certain happiness level, and the Pokémon levels up, and it's day.
|
||||
/// </summary>
|
||||
public record HappinessDayEvolution : IEvolution
|
||||
{
|
||||
@@ -159,12 +159,12 @@ public record HappinessDayEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required byte Happiness { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Evolves when above a certain happiness level, and the Pokemon levels up, and it's night.
|
||||
/// Evolves when above a certain happiness level, and the Pokémon levels up, and it's night.
|
||||
/// </summary>
|
||||
public record HappinessNightEvolution : IEvolution
|
||||
{
|
||||
@@ -173,7 +173,7 @@ public record HappinessNightEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required byte Happiness { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public record HappinessNightEvolution : IEvolution
|
||||
/// </summary>
|
||||
public record TradeEvolution : IEvolution
|
||||
{
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public record TradeSpeciesEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required StringKey WithSpecies { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ public record TradeItemEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required StringKey Item { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
|
||||
@@ -229,6 +229,6 @@ public record CustomEvolution : IEvolution
|
||||
/// </summary>
|
||||
public required IReadOnlyDictionary<StringKey, object> Parameters { get; init; }
|
||||
|
||||
/// < inheritdoc />
|
||||
/// <inheritdoc />
|
||||
public required StringKey ToSpecies { get; init; }
|
||||
}
|
||||
@@ -9,13 +9,8 @@ namespace PkmnLib.Static.Species;
|
||||
/// A form is a variant of a specific species. A species always has at least one form, but can have
|
||||
/// many more.
|
||||
/// </summary>
|
||||
public interface IForm
|
||||
public interface IForm : INamedValue
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the form.
|
||||
/// </summary>
|
||||
StringKey Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The height of the form in meters.
|
||||
/// </summary>
|
||||
@@ -27,32 +22,32 @@ public interface IForm
|
||||
float Weight { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The base amount of experience that is gained when beating a Pokemon with this form.
|
||||
/// The base amount of experience that is gained when beating a Pokémon with this form.
|
||||
/// </summary>
|
||||
uint BaseExperience { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The normal types a Pokemon with this form has.
|
||||
/// The normal types a Pokémon with this form has.
|
||||
/// </summary>
|
||||
IReadOnlyList<TypeIdentifier> Types { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The inherent values of a form of species that are used for the stats of a Pokemon.
|
||||
/// The inherent values of a form of species that are used for the stats of a Pokémon.
|
||||
/// </summary>
|
||||
StaticStatisticSet<ushort> BaseStats { get; }
|
||||
ImmutableStatisticSet<ushort> BaseStats { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The possible abilities a Pokemon with this form can have.
|
||||
/// The possible abilities a Pokémon with this form can have.
|
||||
/// </summary>
|
||||
IReadOnlyList<StringKey> Abilities { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The possible hidden abilities a Pokemon with this form can have.
|
||||
/// The possible hidden abilities a Pokémon with this form can have.
|
||||
/// </summary>
|
||||
IReadOnlyList<StringKey> HiddenAbilities { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The moves a Pokemon with this form can learn.
|
||||
/// The moves a Pokémon with this form can learn.
|
||||
/// </summary>
|
||||
ILearnableMoves Moves { get; }
|
||||
|
||||
@@ -102,7 +97,7 @@ public class FormImpl : IForm
|
||||
{
|
||||
/// <inheritdoc cref="FormImpl" />
|
||||
public FormImpl(StringKey name, float height, float weight, uint baseExperience,
|
||||
IEnumerable<TypeIdentifier> types, StaticStatisticSet<ushort> baseStats, IEnumerable<StringKey> abilities,
|
||||
IEnumerable<TypeIdentifier> types, ImmutableStatisticSet<ushort> baseStats, IEnumerable<StringKey> abilities,
|
||||
IEnumerable<StringKey> hiddenAbilities, ILearnableMoves moves, ImmutableHashSet<StringKey> flags)
|
||||
{
|
||||
Name = name;
|
||||
@@ -140,7 +135,7 @@ public class FormImpl : IForm
|
||||
public IReadOnlyList<TypeIdentifier> Types { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public StaticStatisticSet<ushort> BaseStats { get; }
|
||||
public ImmutableStatisticSet<ushort> BaseStats { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> Abilities { get; }
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
namespace PkmnLib.Static;
|
||||
namespace PkmnLib.Static.Species;
|
||||
|
||||
/// <summary>
|
||||
/// Gender is a Pokemon characteristic.
|
||||
/// Gender is a Pokémon characteristic.
|
||||
///
|
||||
/// Required for standard pokemon functions, but somewhat controversial nowadays. Consider adding a feature
|
||||
/// Required for standard Pokémon functions, but somewhat controversial nowadays. Consider adding a feature
|
||||
/// that allows for a more progressive gender system for those that want it?
|
||||
/// </summary>
|
||||
public enum Gender : byte
|
||||
{
|
||||
/// The Pokemon has no gender.
|
||||
/// The Pokémon has no gender.
|
||||
Genderless,
|
||||
/// <summary>
|
||||
/// The Pokemon is male.
|
||||
/// The Pokémon is male.
|
||||
/// </summary>
|
||||
Male,
|
||||
/// <summary>
|
||||
/// The Pokemon is female.
|
||||
/// The Pokémon is female.
|
||||
/// </summary>
|
||||
Female
|
||||
}
|
||||
@@ -3,38 +3,40 @@ using PkmnLib.Static.Utils;
|
||||
namespace PkmnLib.Static.Species;
|
||||
|
||||
/// <summary>
|
||||
/// The storage of the moves a Pokemon can learn.
|
||||
/// The storage of the moves a Pokémon can learn.
|
||||
/// </summary>
|
||||
public interface ILearnableMoves
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a new level move the Pokemon can learn.
|
||||
/// Adds a new level move the Pokémon can learn.
|
||||
/// </summary>
|
||||
/// <param name="level">The level the Pokemon learns the move at.</param>
|
||||
/// <param name="move">The move the Pokemon learns.</param>
|
||||
/// <param name="level">The level the Pokémon learns the move at.</param>
|
||||
/// <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>
|
||||
/// Gets all moves a Pokemon can learn when leveling up to a specific level.
|
||||
/// Gets all moves a Pokémon can learn when leveling up to a specific level.
|
||||
/// </summary>
|
||||
/// <param name="level">The level the Pokemon is learning moves at.</param>
|
||||
/// <returns>The moves the Pokemon learns at that level.</returns>
|
||||
/// <param name="level">The level the Pokémon is learning moves at.</param>
|
||||
/// <returns>The moves the Pokémon learns at that level.</returns>
|
||||
IReadOnlyList<StringKey> GetLearnedByLevel(LevelInt level);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the distinct moves a Pokemon can learn through leveling up.
|
||||
/// Gets the distinct moves a Pokémon can learn through leveling up.
|
||||
/// </summary>
|
||||
/// <returns>The moves the Pokemon can learn through leveling up.</returns>
|
||||
/// <returns>The moves the Pokémon can learn through leveling up.</returns>
|
||||
IReadOnlyList<StringKey> GetDistinctLevelMoves();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public class LearnableMovesImpl : ILearnableMoves
|
||||
{
|
||||
private readonly Dictionary<LevelInt, List<StringKey>> _learnedByLevel = new();
|
||||
private readonly HashSet<StringKey> _distinctLevelMoves = new();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public void AddLevelMove(LevelInt level, StringKey move)
|
||||
{
|
||||
if (!_learnedByLevel.TryGetValue(level, out var value))
|
||||
@@ -44,6 +46,7 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
_distinctLevelMoves.Add(move);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetLearnedByLevel(LevelInt level)
|
||||
{
|
||||
if (!_learnedByLevel.TryGetValue(level, out var value))
|
||||
@@ -51,8 +54,9 @@ public class LearnableMovesImpl : ILearnableMoves
|
||||
return value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<StringKey> GetDistinctLevelMoves()
|
||||
{
|
||||
return _distinctLevelMoves.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,23 +5,18 @@ using PkmnLib.Static.Utils;
|
||||
namespace PkmnLib.Static.Species;
|
||||
|
||||
/// <summary>
|
||||
/// The data belonging to a Pokemon with certain characteristics.
|
||||
/// The data belonging to a Pokémon with certain characteristics.
|
||||
/// </summary>
|
||||
public interface ISpecies
|
||||
public interface ISpecies : INamedValue
|
||||
{
|
||||
/// <summary>
|
||||
/// The national dex identifier of the Pokemon.
|
||||
/// The national dex identifier of the Pokémon.
|
||||
/// </summary>
|
||||
ushort Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the Pokemon.
|
||||
/// </summary>
|
||||
StringKey Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The chance between 0.0 and 1.0 that a Pokemon is female. 0.0 means always male, 1.0 means always female.
|
||||
/// If less than 0, the Pokemon is genderless.
|
||||
/// The chance between 0.0 and 1.0 that a Pokémon is female. 0.0 means always male, 1.0 means always female.
|
||||
/// If less than 0, the Pokémon is genderless.
|
||||
/// </summary>
|
||||
float GenderRate { get; }
|
||||
|
||||
@@ -31,23 +26,23 @@ public interface ISpecies
|
||||
StringKey GrowthRate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// How hard it is to capture a Pokemon. 255 means this will be always caught, 0 means this is
|
||||
/// How hard it is to capture a Pokémon. 255 means this will be always caught, 0 means this is
|
||||
/// uncatchable.
|
||||
/// </summary>
|
||||
byte CaptureRate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The base happiness of the Pokemon.
|
||||
/// The base happiness of the Pokémon.
|
||||
/// </summary>
|
||||
byte BaseHappiness { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The forms that belong to this Pokemon.
|
||||
/// The forms that belong to this Pokémon.
|
||||
/// </summary>
|
||||
IReadOnlyDictionary<StringKey, IForm> Forms { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The arbitrary flags that can be set on a Pokemon for script use.
|
||||
/// The arbitrary flags that can be set on a Pokémon for script use.
|
||||
/// </summary>
|
||||
ImmutableHashSet<StringKey> Flags { get; }
|
||||
|
||||
@@ -57,7 +52,7 @@ public interface ISpecies
|
||||
bool TryGetForm(StringKey id, [MaybeNullWhen(false)] out IForm form);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the form the Pokemon will have by default, if no other form is specified.
|
||||
/// Gets the form the Pokémon will have by default, if no other form is specified.
|
||||
/// </summary>
|
||||
IForm GetDefaultForm();
|
||||
|
||||
@@ -67,12 +62,12 @@ public interface ISpecies
|
||||
Gender GetRandomGender(IRandom rand);
|
||||
|
||||
/// <summary>
|
||||
/// Check whether the Pokemon has a specific flag set.
|
||||
/// Check whether the Pokémon has a specific flag set.
|
||||
/// </summary>
|
||||
bool HasFlag(string key);
|
||||
|
||||
/// <summary>
|
||||
/// The data regarding into which Pokemon this species can evolve, and how.
|
||||
/// The data regarding into which Pokémon this species can evolve, and how.
|
||||
/// </summary>
|
||||
IReadOnlyList<IEvolution> EvolutionData { get; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user