2023-11-05 22:20:35 +00:00
|
|
|
using System;
|
2021-01-02 08:46:09 +00:00
|
|
|
using static PKHeX.Core.Species;
|
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Tables used for <see cref="AbilityVerifier"/>
|
|
|
|
/// </summary>
|
|
|
|
internal static class AbilityBreedLegality
|
2021-01-02 08:46:09 +00:00
|
|
|
{
|
2023-12-04 04:13:20 +00:00
|
|
|
private static ReadOnlySpan<byte> BanHidden5 =>
|
|
|
|
[
|
2023-11-05 22:20:35 +00:00
|
|
|
0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
|
|
|
|
0x10, 0x10, 0x20, 0x00, 0x01, 0x11, 0x02, 0x00, 0x49, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x90, 0x04,
|
|
|
|
0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x86, 0x80,
|
|
|
|
0x49, 0x00, 0x40, 0x00, 0x48, 0x02, 0x00, 0x00, 0x10, 0x00, 0x12,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x82, 0x24, 0x80, 0x0A, 0x00,
|
|
|
|
0x00, 0x0C, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0xA0, 0x84, 0x80,
|
|
|
|
0x40, 0x08, 0x12,
|
2023-12-04 04:13:20 +00:00
|
|
|
];
|
2023-11-05 22:20:35 +00:00
|
|
|
|
2021-01-02 08:46:09 +00:00
|
|
|
/// <summary>
|
2022-06-18 18:04:24 +00:00
|
|
|
/// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.Gen5"/>
|
|
|
|
/// </summary>
|
2023-11-05 22:20:35 +00:00
|
|
|
public static bool IsHiddenPossible5(ushort species)
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
2023-11-05 22:20:35 +00:00
|
|
|
var index = species >> 3;
|
|
|
|
var table = BanHidden5;
|
|
|
|
if (index >= table.Length)
|
|
|
|
return true;
|
|
|
|
return (BanHidden5[index] & (1 << (species & 7))) == 0;
|
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.Gen6"/>
|
|
|
|
/// </summary>
|
2023-11-05 22:20:35 +00:00
|
|
|
public static bool IsHiddenPossible6(ushort species, byte form) => species switch
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
// Same abilities (1/2/H), not available as H
|
2023-11-05 22:20:35 +00:00
|
|
|
(int)Castform => false,
|
|
|
|
(int)Carnivine => false,
|
|
|
|
(int)Rotom => false,
|
|
|
|
(int)Phione => false,
|
|
|
|
(int)Archen => false,
|
|
|
|
(int)Cryogonal => false,
|
2022-06-18 18:04:24 +00:00
|
|
|
|
2023-11-05 22:20:35 +00:00
|
|
|
(int)Flabébé => form is not (2 or 4), // Orange or White - not available in Friend Safari or Horde
|
|
|
|
(int)Honedge => false,
|
|
|
|
(int)Furfrou => false,
|
|
|
|
(int)Pumpkaboo => form is not (1 or 2), // Previous-Gen: Size & Ability inherit from mother
|
|
|
|
|
|
|
|
_ => true,
|
2022-06-18 18:04:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.Gen7"/>
|
|
|
|
/// </summary>
|
2023-11-05 22:20:35 +00:00
|
|
|
public static bool IsHiddenPossible7(ushort species, byte form) => species switch
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
// Same abilities (1/2/H), not available as H
|
2023-11-05 22:20:35 +00:00
|
|
|
(int)Carnivine => false,
|
|
|
|
(int)Rotom => false,
|
|
|
|
(int)Phione => false,
|
|
|
|
(int)Archen => false,
|
|
|
|
(int)Cryogonal => false,
|
|
|
|
(int)Honedge => false,
|
|
|
|
(int)Pumpkaboo => form is not (1 or 2), // Previous-Gen: Size & Ability inherit from mother
|
|
|
|
|
|
|
|
(int)Minior => false, // No SOS Encounter
|
|
|
|
(int)Wimpod => false, // SOS slots have 0 call rate
|
|
|
|
(int)Komala => false, // SOS slots have 0 call rate
|
|
|
|
_ => true,
|
2022-06-18 18:04:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/// <summary>
|
2022-08-26 17:07:24 +00:00
|
|
|
/// Species that cannot be bred with a Hidden Ability originating in <see cref="GameVersion.BDSP"/>
|
2021-01-02 08:46:09 +00:00
|
|
|
/// </summary>
|
2023-11-05 22:20:35 +00:00
|
|
|
public static bool IsHiddenPossibleHOME(ushort eggSpecies) => eggSpecies is not (int)Phione; // Everything else can!
|
2021-01-02 08:46:09 +00:00
|
|
|
}
|