Adds egggroups

This commit is contained in:
Deukhoofd 2024-09-30 14:28:26 +02:00
parent a39c77745d
commit c088386ba3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 10 additions and 4 deletions

View File

@ -55,7 +55,7 @@ public static class SpeciesDataLoader
var species = new SpeciesImpl(serialized.Id, serialized.Species, genderRate, serialized.GrowthRate, var species = new SpeciesImpl(serialized.Id, serialized.Species, genderRate, serialized.GrowthRate,
serialized.CatchRate, serialized.BaseHappiness, forms, serialized.CatchRate, serialized.BaseHappiness, forms,
serialized.Flags.Select(x => new StringKey(x)).ToImmutableHashSet(), evolutions); serialized.Flags.Select(x => new StringKey(x)), evolutions, serialized.EggGroups.Select(x => (StringKey)x));
return species; return species;
} }

View File

@ -70,6 +70,8 @@ public interface ISpecies : INamedValue
/// The data regarding into which Pokémon this species can evolve, and how. /// The data regarding into which Pokémon this species can evolve, and how.
/// </summary> /// </summary>
IReadOnlyList<IEvolution> EvolutionData { get; } IReadOnlyList<IEvolution> EvolutionData { get; }
ICollection<StringKey> EggGroups { get; }
} }
/// <inheritdoc /> /// <inheritdoc />
@ -77,8 +79,8 @@ public class SpeciesImpl : ISpecies
{ {
/// <inheritdoc cref="SpeciesImpl" /> /// <inheritdoc cref="SpeciesImpl" />
public SpeciesImpl(ushort id, StringKey name, float genderRate, StringKey growthRate, byte captureRate, public SpeciesImpl(ushort id, StringKey name, float genderRate, StringKey growthRate, byte captureRate,
byte baseHappiness, IReadOnlyDictionary<StringKey, IForm> forms, ImmutableHashSet<StringKey> flags, byte baseHappiness, IReadOnlyDictionary<StringKey, IForm> forms, IEnumerable<StringKey> flags,
IReadOnlyList<IEvolution> evolutionData) IReadOnlyList<IEvolution> evolutionData, IEnumerable<StringKey> eggGroups)
{ {
Id = id; Id = id;
Name = name; Name = name;
@ -87,8 +89,9 @@ public class SpeciesImpl : ISpecies
CaptureRate = captureRate; CaptureRate = captureRate;
BaseHappiness = baseHappiness; BaseHappiness = baseHappiness;
Forms = forms; Forms = forms;
Flags = flags; Flags = flags.ToImmutableHashSet();
EvolutionData = evolutionData; EvolutionData = evolutionData;
EggGroups = eggGroups.ToImmutableHashSet();
if (Forms.Count == 0) if (Forms.Count == 0)
throw new ArgumentException("Species must have at least one form."); throw new ArgumentException("Species must have at least one form.");
if (!Forms.ContainsKey("default")) if (!Forms.ContainsKey("default"))
@ -122,6 +125,9 @@ public class SpeciesImpl : ISpecies
/// <inheritdoc /> /// <inheritdoc />
public IReadOnlyList<IEvolution> EvolutionData { get; } public IReadOnlyList<IEvolution> EvolutionData { get; }
/// <inheritdoc />
public ICollection<StringKey> EggGroups { get; }
/// <inheritdoc /> /// <inheritdoc />
public bool TryGetForm(StringKey id, [MaybeNullWhen(false)] out IForm form) => Forms.TryGetValue(id, out form); public bool TryGetForm(StringKey id, [MaybeNullWhen(false)] out IForm form) => Forms.TryGetValue(id, out form);