2020-12-08 04:54:55 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logic related to breeding.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class Breeding
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Species that have special handling for breeding.
|
|
|
|
|
/// </summary>
|
2020-12-22 01:17:56 +00:00
|
|
|
|
internal static readonly HashSet<int> MixedGenderBreeding = new()
|
2020-12-08 04:54:55 +00:00
|
|
|
|
{
|
|
|
|
|
(int)Species.NidoranF,
|
|
|
|
|
(int)Species.NidoranM,
|
|
|
|
|
|
|
|
|
|
(int)Species.Volbeat,
|
|
|
|
|
(int)Species.Illumise,
|
|
|
|
|
|
|
|
|
|
(int)Species.Indeedee, // male/female
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks if the <see cref="species"/> can be born with inherited moves from the parents.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="species">Entity species ID</param>
|
|
|
|
|
/// <returns>True if can inherit moves, false if cannot.</returns>
|
|
|
|
|
internal static bool GetCanInheritMoves(int species)
|
|
|
|
|
{
|
|
|
|
|
if (Legal.FixedGenderFromBiGender.Contains(species)) // Nincada -> Shedinja loses gender causing 'false', edge case
|
|
|
|
|
return true;
|
|
|
|
|
var pi = PKX.Personal[species];
|
|
|
|
|
if (!pi.Genderless && !pi.OnlyMale)
|
|
|
|
|
return true;
|
|
|
|
|
if (MixedGenderBreeding.Contains(species))
|
|
|
|
|
return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-22 01:17:56 +00:00
|
|
|
|
internal static readonly HashSet<int> SplitBreed_3 = new()
|
2020-12-08 04:54:55 +00:00
|
|
|
|
{
|
|
|
|
|
// Incense
|
|
|
|
|
(int)Species.Marill, (int)Species.Azumarill,
|
|
|
|
|
(int)Species.Wobbuffet,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Species that can yield a different baby species when bred.
|
|
|
|
|
/// </summary>
|
2020-12-22 01:17:56 +00:00
|
|
|
|
private static readonly HashSet<int> SplitBreed = new(SplitBreed_3)
|
2020-12-08 04:54:55 +00:00
|
|
|
|
{
|
|
|
|
|
// Incense
|
|
|
|
|
(int)Species.Chansey, (int)Species.Blissey,
|
|
|
|
|
(int)Species.MrMime, (int)Species.MrRime,
|
|
|
|
|
(int)Species.Snorlax,
|
|
|
|
|
(int)Species.Sudowoodo,
|
|
|
|
|
(int)Species.Mantine,
|
|
|
|
|
(int)Species.Roselia, (int)Species.Roserade,
|
|
|
|
|
(int)Species.Chimecho,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
internal static ICollection<int> GetSplitBreedGeneration(int generation)
|
|
|
|
|
{
|
2020-12-24 01:14:38 +00:00
|
|
|
|
return generation switch
|
2020-12-08 04:54:55 +00:00
|
|
|
|
{
|
2020-12-24 01:14:38 +00:00
|
|
|
|
3 => SplitBreed_3,
|
|
|
|
|
4 or 5 or 6 or 7 or 8 => SplitBreed,
|
|
|
|
|
_ => Array.Empty<int>(),
|
|
|
|
|
};
|
2020-12-08 04:54:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|