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,
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;
}

View File

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